AI Hints
Home›PostgreSQL Tutorial›Interview Questions and Quiz
PostgreSQL · Lesson 115 of 120

Interview Questions, Part 1

Core concepts.

⏱ 2 min read▶ Video at 1:43:58🎓 Free
Watch this lesson in the PostgreSQL courseWatch on YouTube ↗Full PostgreSQL course

Here are the Postgres questions that come up most in interviews, with short, clear answers. Part one covers the core ideas.

  • Common questions
  • Short answers
  • Core ideas

Core questions

What is MVCC? Postgres keeps row versions, so readers and writers don't block each other. Why vacuum? To clean up dead row versions. What's the difference between a primary key and a unique constraint? A primary key is unique and not null, and there's only one per table.

QuestionShort answer
MVCC?row versions, no read locks
Why VACUUM?remove dead rows
PK vs UNIQUE?PK: unique + not null, one per table

Types and design

Json or JSONB? JSONB, because it's indexable and faster. Serial or identity? Identity, the modern standard. Money type? Numeric, never floating point. Timestamp or timestamptz? Timestamptz, for real moments.

QuestionShort answer
json vs jsonb?jsonb
serial vs identity?identity
Money?numeric
Timestamps?timestamptz

Summary

Know MVCC, vacuum, keys and the right types, and you'll handle the core questions. Next, part two.

Key takeaways
  • MVCC
  • VACUUM
  • Types
Next up: Interview Questions, Part 2 — performance and safety