Interview Q&A / PostgreSQL
PostgreSQL interview questions
Indexes, EXPLAIN, transactions and isolation, JSONB and the Postgres specifics backend interviews probe.
Prefer rapid revision? Practise PostgreSQL short interview answers →
- Can a UNIQUE column in PostgreSQL contain more than one NULL?
Yes by default, because NULL is unknown and two unknowns are not considered equal. From PostgreSQL 15 you can add NULLS NOT DISTINCT to make NULLs count as duplicates.
IntermediateQuick answer1 min read - Should you use an ENUM type, a CHECK constraint, or a lookup table for a fixed set of values?
A CHECK on text is the easiest to change, an ENUM is compact and ordered but awkward to alter, and a lookup table with a foreign key is best when the values need extra data or change often.
IntermediateQuick answer1 min read