Boarding pass · PostgreSQL Intermediate
PostgreSQL · Intermediate interview
An AI mock interview for developers comfortable with Postgres basics. Go deeper into index types, MVCC and VACUUM, transactions, and JSONB and other features.
- Voice interview
- Live feedback
- Browser-only
- No installation required
Your report · sample
AI Readiness Score
Finish the mock and get this report — scored on content and English, with concrete tips and a model answer for every question, plus a study plan.
Your flight path
Five steps to interview-ready.
From a quick warm-up to a personalised study plan — here's the whole loop, and what you get at each gate.
Step 01
Preparation
Skim the topics and warm up — you're briefed before takeoff.
Step 02
AI Interview
A realistic AI interviewer asks tailored questions — answer by voice or text.
Step 03
Instant Score
Finish and get a 0–100 readiness score across content and English.
Step 04
AI Feedback
Concrete tips and a rewritten model answer for every response.
Step 05
Study Plan
A personalised plan targets your weakest areas — so the next run scores higher.
Preview the AI demo
See one answer scored, end to end.
The whole loop on sample data — question, your answer, instant feedback and a study plan. Hover to pause.
Interviewer · Question 1
“Tell me about yourself.”
Who it's for
- Developers writing real Postgres queries
- Backend engineers tuning schemas
- Anyone targeting mid-level data roles
- Devs sharpening before interviews
What you'll practice
- Choosing the right index type
- MVCC, VACUUM and isolation levels
- CTEs, window functions and EXPLAIN
- Querying and indexing JSONB
Topics covered
What this level expects.
Indexing
- Index types
- Partial & expression
- Covering (INCLUDE)
Concurrency
- MVCC
- VACUUM & bloat
- Isolation levels
Queries
- CTEs & windows
- EXPLAIN ANALYZE
- DISTINCT ON & lateral
JSON & extensions
- Querying JSONB
- Full-text search
- Extensions
Practice questions
12 questions, with model answers.
Read them, then run the live mock to answer out loud and get scored. Tap any question to reveal a model answer.
01What index types does Postgres offer and when do you use each?Indexing
B-tree for equality/range and ordering (the default). GIN for 'contains' queries over composite values — JSONB, arrays, and full-text search. GiST for geometric/spatial and nearest-neighbour (PostGIS, ranges). BRIN for very large, naturally-ordered tables (like time-series) where it stores tiny summaries per block. Hash for equality only. You match the index type to the data and operators your queries use.
02What are partial and expression indexes?Indexing
A partial index covers only rows matching a WHERE condition (e.g. WHERE active), making it smaller and faster when queries always filter on that condition — great for indexing a hot subset. An expression (functional) index indexes the result of an expression (e.g. LOWER(email)) so queries using that same expression can be index-served. Both target specific query patterns to keep indexes lean and usable.
CREATE INDEX ON users (LOWER(email)); CREATE INDEX ON orders (created_at) WHERE status = 'open';
03What is a covering index with INCLUDE?Indexing
A covering index stores extra non-key columns via INCLUDE so a query can be answered entirely from the index (an index-only scan) without visiting the table heap, eliminating extra I/O. The included columns aren't part of the search key but are available in the index. It's a targeted optimization for read-heavy queries that select a few columns by an indexed predicate.
04What is MVCC in PostgreSQL and how does it work?Concurrency
Multi-Version Concurrency Control means each write creates a new row version rather than overwriting, and each transaction sees a consistent snapshot based on transaction ids (xmin/xmax). Readers don't block writers and writers don't block readers, which gives high concurrency. The cost is that old, no-longer-visible row versions (dead tuples) accumulate and must be cleaned up.
05Why does Postgres need VACUUM, and what does autovacuum do?Concurrency
Because MVCC leaves dead tuples behind, VACUUM reclaims that space and updates visibility info; it also prevents transaction-id wraparound, a critical correctness issue. autovacuum runs VACUUM and ANALYZE automatically based on table activity. If it can't keep up, tables bloat (wasted space, slower scans) and statistics go stale — so tuning autovacuum on busy tables is a common production task.
06What isolation levels does Postgres support?Concurrency
Postgres implements READ COMMITTED (the default — each statement sees a fresh snapshot), REPEATABLE READ (snapshot fixed at transaction start, preventing non-repeatable and phantom reads, and detecting some serialization issues), and SERIALIZABLE (full serializable via SSI, which may abort transactions that would violate serializability). Note Postgres's REPEATABLE READ already prevents phantoms, unlike the SQL standard's minimum. You choose higher levels for read-modify-write correctness, handling serialization failures with retries.
07How do CTEs and window functions work in Postgres?Queries
CTEs (WITH) name subqueries for readability and support recursion for hierarchies; note that since PG12 they're inlined by default (no longer an optimization fence unless MATERIALIZED). Window functions compute values across a set of rows (OVER(PARTITION BY ... ORDER BY ...)) without collapsing them — for rankings, running totals, and per-group calculations alongside each row. Both are standard SQL features Postgres implements fully.
08What does EXPLAIN ANALYZE tell you?Queries
EXPLAIN shows the planner's chosen execution plan; adding ANALYZE actually runs the query and reports real timing and row counts per node. You compare estimated vs actual rows (big gaps mean stale statistics), spot sequential scans on large tables, expensive sorts, and nested loops over many rows. It's the primary tool for diagnosing why a query is slow and whether your index is used.
09What are DISTINCT ON and LATERAL joins useful for?Queries
DISTINCT ON (Postgres-specific) returns the first row per group given an ORDER BY — a concise way to get the latest record per key without window-function boilerplate. A LATERAL join lets a subquery in the FROM clause reference columns from preceding tables, so you can run a correlated subquery per row (e.g. top 3 orders per customer). Both solve common 'per-group' problems elegantly.
10How do you query and index a JSONB column?JSON & extensions
You navigate JSONB with operators: -> returns a JSON object/element, ->> returns text, #> for paths, and @> tests containment. To make containment and key queries fast you create a GIN index on the column (or a specific expression). For querying a known scalar path you can also use a B-tree expression index on (data->>'field'). Indexing is what keeps JSONB queries from doing full scans.
CREATE INDEX ON docs USING GIN (data);
SELECT * FROM docs WHERE data @> '{"status":"active"}';11How does full-text search work in Postgres?JSON & extensions
Postgres has built-in full-text search using tsvector (preprocessed document tokens) and tsquery (search terms), matched with the @@ operator and ranked with ts_rank. You typically store or compute a tsvector, index it with GIN, and query with to_tsquery/plainto_tsquery. It handles stemming and stop words, giving decent search without a separate engine for many apps.
12What useful extensions should you know about?JSON & extensions
pg_stat_statements aggregates query statistics to find your slowest/most-frequent queries — essential for tuning. PostGIS adds geospatial types and indexing. pgcrypto provides cryptographic functions, uuid-ossp/pgcrypto generate UUIDs, and others like pg_trgm enable fuzzy/trigram search. Extensions are a core Postgres strength — you enable them with CREATE EXTENSION to add capabilities without external systems.
Preparation tips
Walk in ready.
- Know which index type fits JSONB, arrays, and full-text
- Be able to explain dead tuples and bloat
- Practise a window function and a CTE
- Use pg_stat_statements to find slow queries
Ready for the real thing?
Run a 6-question PostgreSQL mock interview, answer out loud, and get a readiness score with tips and model answers.
More intermediate interviews