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 →
- What do the cost numbers in an EXPLAIN plan actually mean?
cost=A..B gives the estimated startup cost (before the first row) and total cost, in arbitrary planner units based on page fetches and CPU work. They are for comparing plans, not seconds or milliseconds.
BeginnerQuick answer1 min read - What do MATERIALIZED and NOT MATERIALIZED do on a CTE?
They control whether PostgreSQL computes the CTE once and stores the result (MATERIALIZED) or folds it into the outer query like a subquery (NOT MATERIALIZED). Before version 12, every CTE was materialized and acted as an optimisation fence.
AdvancedQuick answer1 min read