Interview Q&A / PostgreSQL

INTERVIEW Q&A · 69 QUESTIONS

PostgreSQL interview questions

Indexes, EXPLAIN, transactions and isolation, JSONB and the Postgres specifics backend interviews probe.

  1. 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
  2. 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