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 →
- Does the column order in a multi-column B-tree index matter?
Yes. A composite index is sorted by the first column, then the second within it, and so on. It helps queries that filter on a leading prefix of its columns, and it is much less useful if only a later column is filtered.
BeginnerQuick answer1 min read - What is a partial index in PostgreSQL and when is it useful?
A partial index has a WHERE clause and indexes only the rows that match it. It is smaller and faster to maintain, and ideal when queries target a small, well-defined slice such as unprocessed jobs or active users.
BeginnerQuick answer1 min read - What is an expression index, and how do you make WHERE lower(email) = 'x' fast?
An expression index stores the result of a function or expression instead of the raw column. Create an index on lower(email) and queries that use exactly lower(email) can use it; a plain index on email cannot help.
BeginnerQuick answer1 min read