D
DevPrepSystematic Prep
DEVPREP CODEX · #18

PostgreSQL Interview Questions

75 curated questions graded from Foundations (Easy) to Practical Patterns (Medium) and Internals & Architecture (Hard).

TOTAL QUESTIONS

75

THEORY QUESTIONS

75

IMPLEMENTATION FOLIOS

0

FREE QUESTIONS

5 / Level

Easy Level·25 Questions Total

Foundations & Core Concepts

Open Full Easy List
Q1What is PostgreSQL and what distinguishes it?
  • Advanced open-source object-relational DB known for standards compliance, extensibility (custom types/extensions), and correctness.
  • Standouts: rich indexing (B-tree/GIN/GiST/BRIN), full-text search, JSONB, window functions, MVCC without read locks, transactional DDL.
  • Single license (PostgreSQL License), no paid editions — feature parity everywhere.

Q2What is a primary key and how does Postgres implement it?
  • Uniquely identifies rows; PRIMARY KEY creates a unique B-tree index + NOT NULL implicitly.
  • One PK per table; choice of int/bigserial vs UUID trade-offs (size, ordering, fragmentation).
  • PK index backs fast lookups; clustered tables don't exist like SQL Server — heap storage with index-organized access via the index only.

Q3What are the main differences between CHAR, VARCHAR and TEXT?
  • CHAR(n): blank-padded fixed length (rarely desired).
  • VARCHAR(n): variable with limit enforced.
  • TEXT: unlimited — Postgres performance identical across all three; use TEXT + CHECK constraint for length when needed. Interview nugget: unlike other engines, there's NO performance penalty choosing TEXT.

Q4What does SERIAL vs IDENTITY vs UUID mean for keys?
  • SERIAL legacy pseudo-type creating sequence default; GENERATED ALWAYS AS IDENTITY SQL-standard preferred (protects against manual id inserts).
  • Sequences have gaps on rollback by design.
  • UUIDv4 random → index bloat/fragmentation on big tables; UUIDv7/time-ordered mitigates. Choose bigint identity for internal high-write tables.

Q5What is NULL and how do IS NULL / COALESCE work?
  • NULL = unknown/absent, not zero/empty string.
  • Comparisons yield NULL (WHERE col <> 'x' excludes NULLs!) — explicit IS NULL/IS NOT NULL required.
  • COALESCE(a,b,c) first non-null; NULLIF(a,b) returns null when equal (divide-by-zero guard pattern).

20 More Easy Questions Locked

Unlock the complete PostgreSQL Easy question bank

Get instant access to all 25 questions, in-depth model answers, code sandboxes, and all 27+ technologies for a single one-time payment.

Unlock All — One-time payment · Lifetime access
DEDICATED LEVEL PAGES

Browse All PostgreSQL Questions by Difficulty

INTERNAL LINKING & DEPENDENCIES

Related Technologies to PostgreSQL

CAREER PATHWAYS

PostgreSQL is a key requirement for these engineering roles:

PostgreSQL Interview Questions — Easy, Medium & Hard | DevPrep | DevPrep