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 →
- How do you use array columns in PostgreSQL, and when are they a bad idea?
A column can hold an array such as text[], queried with ANY, the contains operator @> and unnest. They suit small, simple lists read together with the row; use a separate table when you need foreign keys, per-item data, or heavy filtering by item.
BeginnerQuick answer1 min read - How do you turn a JSONB array into rows in PostgreSQL?
Use jsonb_array_elements (or jsonb_array_elements_text for plain strings) in the FROM clause, usually with a lateral join. Each array element becomes one row you can filter, join or aggregate.
IntermediateQuick answer1 min read