PostgreSQL Interview Questions (2026): By Level, With Model Answers

How to use this

Postgres is where a lot of “the app is slow” problems actually live. These questions check whether a candidate can reason about indexes, plans and concurrency.

Hiring a PostgreSQL developer is easy. Telling a real one from a convincing résumé is the hard part — and it’s most of what we do. These are grouped by level, because the same question that stretches a junior is a warm-up for a senior.

Junior PostgreSQL interview questions

0–2 years

Fundamentals.

What makes PostgreSQL different from MySQL?

What a strong answer covers

Strong standards compliance, rich types (JSONB, arrays), extensibility, and robust MVCC concurrency; both are solid but differ in features and defaults.

Red flag

Cannot name a concrete difference.

What is a primary key and a unique constraint?

What a strong answer covers

A primary key uniquely identifies rows and is not null; unique constraints enforce uniqueness on other columns, backed by an index.

Red flag

Confuses the two or thinks uniqueness is free.

What are common data types you reach for?

What a strong answer covers

Appropriate integer/numeric types, text, timestamptz, boolean, uuid and jsonb; choosing well saves storage and bugs.

Red flag

Stores everything as text.

What is the difference between timestamp and timestamptz?

What a strong answer covers

timestamptz stores an instant normalised to UTC; timestamp is naive. Use timestamptz to avoid timezone bugs.

Red flag

Uses naive timestamps and gets timezone bugs.

What is an index, at a basic level?

What a strong answer covers

A structure (usually B-tree) that speeds lookups at the cost of storage and slower writes.

Red flag

Adds an index to every column reflexively.

What is a foreign key?

What a strong answer covers

A constraint enforcing that a value references an existing row in another table, protecting referential integrity.

Red flag

Skips foreign keys and ends up with orphaned rows.

What does NULL mean and how do you handle it?

What a strong answer covers

Unknown/absent; comparisons need IS NULL, and it affects aggregates, uniqueness and joins.

Red flag

Compares with = NULL.

What is JSONB and when do you use it?

What a strong answer covers

A binary JSON type supporting indexing and operators, good for semi-structured data — but not a reason to avoid proper columns.

Red flag

Puts all data in one jsonb blob.

Mid-level PostgreSQL interview questions

2–5 years

Indexing and transactions.

What index types does Postgres offer beyond B-tree?

What a strong answer covers

GIN (for jsonb/arrays/full-text), GiST, BRIN for huge ordered tables, and hash; choosing the right one matters for the query.

Red flag

Only knows B-tree and can’t index jsonb.

How do you read an EXPLAIN ANALYZE plan?

What a strong answer covers

Look at scan types (seq vs index), row estimates vs actuals, join methods and costly nodes to find the bottleneck.

Red flag

Never reads plans and guesses.

What is MVCC and how does it affect you?

What a strong answer covers

Multi-Version Concurrency Control keeps row versions so readers don’t block writers; dead tuples accumulate and need vacuuming.

Red flag

Unaware why the table bloats over time.

What does VACUUM do and why does it matter?

What a strong answer covers

Reclaims space from dead tuples and updates statistics; autovacuum usually handles it, but heavy write tables may need tuning.

Red flag

Ignores bloat until performance collapses.

What is a partial and an expression index?

What a strong answer covers

Partial indexes cover a subset of rows (e.g. active only); expression indexes index a computed value so a function query can use it.

Red flag

Wonders why lower(email) queries don’t use the index.

What are the transaction isolation levels in Postgres?

What a strong answer covers

Read Committed (default), Repeatable Read and Serializable, trading concurrency against anomalies.

Red flag

Assumes default isolation prevents all anomalies.

How do row-level locks and deadlocks arise?

What a strong answer covers

Concurrent updates to the same rows in different orders; consistent ordering and short transactions reduce deadlocks.

Red flag

No concept of lock ordering.

What is a CTE and are they always optimisation-safe?

What a strong answer covers

A named subquery for readability/recursion; historically materialised, they can be inlined in newer versions — know your version’s behaviour.

Red flag

Assumes CTEs are always free.

Senior PostgreSQL interview questions

5+ years

Performance and operations.

How do you diagnose a slow query in production?

What a strong answer covers

pg_stat_statements to find offenders, EXPLAIN (ANALYZE, BUFFERS), checking indexes, statistics and bloat.

Red flag

Rewrites queries blindly with no measurement.

When and how do you use table partitioning?

What a strong answer covers

For very large tables partitioned by range/list (e.g. time) to prune scans and ease maintenance; it adds planning complexity.

Red flag

Partitions on a key that doesn’t help pruning.

How do connection pooling and its absence affect Postgres?

What a strong answer covers

Each connection is a process, so many idle connections hurt; a pooler (PgBouncer) is often essential at scale.

Red flag

Opens thousands of direct connections.

How do you run zero-downtime schema changes?

What a strong answer covers

Add columns/indexes concurrently, avoid long locks, backfill in batches, and use expand/contract for renames.

Red flag

Runs a blocking ALTER on a huge live table.

How do you scale reads and writes?

What a strong answer covers

Read replicas and caching for reads; partitioning, tuning and careful schema for writes; sharding as a last resort.

Red flag

Assumes vertical scaling is the only lever.

How do you tune autovacuum for a write-heavy table?

What a strong answer covers

Lower thresholds and increase workers/cost limits for hot tables to keep bloat and transaction wraparound in check.

Red flag

Leaves defaults and hits wraparound risk.

How do you handle high-concurrency counters or hotspots?

What a strong answer covers

Avoid a single hot row; use techniques like sharded counters or upserts with care to reduce contention.

Red flag

Serialises all updates through one hot row.

When is Postgres the wrong tool?

What a strong answer covers

For pure key-value at massive scale, wide-column workloads, or when you need a different consistency/scale profile — they can justify the tradeoff.

Red flag

Treats Postgres as the answer to every data problem.

Skip the screening entirely.We vet PostgreSQL engineers so you don’t have to — embed one in your team, or have us build it.

Hire PostgreSQL developersCompare us

Build and score a full interview with our free interview scorecard tool, browse the full question hub, or see how we interview engineers.

Share