Skip to main content

PostgreSQL Interview Cheat Sheet

Top 50 interview questions with concise answers. Print this page or save as PDF for offline study.

View All PostgreSQL Questions

1. What is PostgreSQL?

2. What is a database cluster in PostgreSQL?

3. What is a schema in PostgreSQL?

4. What is the difference between a table and a view?

5. What is a primary key in PostgreSQL?

6. What is a foreign key?

7. What data types does PostgreSQL support?

8. What is the purpose of the SELECT statement?

9. What is the WHERE clause used for?

10. What is ORDER BY in PostgreSQL?

11. What is the LIMIT clause?

12. What is a UNIQUE constraint?

13. What is the purpose of the INSERT statement?

14. What is the difference between DELETE and DROP?

15. What is a default value in PostgreSQL?

16. What is the PostgreSQL psql tool used for?

17. What is the purpose of the SERIAL data type?

18. What is the difference between TEXT and VARCHAR?

19. What are ENUM types used for?

20. What is a CHECK constraint?

21. What is the purpose of the RETURNING clause in PostgreSQL?

22. What is the difference between INNER JOIN and FULL OUTER JOIN?

23. What is a sequence in PostgreSQL?

24. What is the purpose of the COALESCE function?

25. What are indexes in PostgreSQL and why are they important?

26. What is a partial index?

27. What is a composite index?

28. What is a materialized view?

29. What is the difference between DELETE and TRUNCATE in PostgreSQL?

30. What is the VACUUM operation in PostgreSQL?

31. What is the ANALYZE command used for?

32. What is the difference between a function and a stored procedure in PostgreSQL?

33. What is PostgreSQL’s JSONB data type?

34. What are foreign data wrappers (FDW)?

35. What is the purpose of the EXPLAIN command?

36. What is PostgreSQL’s MVCC and how does it enable concurrent reads and writes?

37. What is a tuple in PostgreSQL?

38. What is a transaction ID and why is wraparound dangerous?

39. What is VACUUM FULL and how does it differ from regular VACUUM?

40. What is the visibility map in PostgreSQL?

41. What is an index-only scan?

42. What is the difference between B-Tree, GIN, and GiST indexes?

43. When would you use a BRIN index?

44. What is the purpose of pg_stat_activity?

45. What is a CTE and why use it?

46. What is the difference between a CTE and a subquery?

47. How do recursive CTEs work?

48. What are dead tuples and why do they accumulate?

49. How does PostgreSQL handle deadlocks?

50. What is a tablespace?

Ready to level up? Start Practice