PostgreSQL
Relational database internals, query optimization, indexing, transactions, and operational concerns for backend interviews.
01Relational Model & SQL Fundamentals
JuniorNot started
Relational Model & SQL Fundamentals
Relations, tuples, attributes and the SQL that operates on them — keys, NULL semantics, join types, and the logical query processing order interviewers test first.
01What is a relation, a tuple, an attribute? Map these to SQL terms.Junior02Difference between primary key, unique constraint, and a unique index.Junior03Difference between NULL, empty string, and zero. How does NULL behave in WHERE, GROUP BY, joins, and aggregates?Mid02Normalization & Schema Design
MidNot started
Normalization & Schema Design
Normal forms walked through a concrete table, when denormalization pays off, modeling relationships and polymorphism, and surrogate vs natural keys including UUID v7.
01What are 1NF, 2NF, 3NF, BCNF? Walk a denormalized table through each form.Mid02When is denormalization the right choice? Trade-offs.Mid03How do you model a many-to-many relationship?Junior03PostgreSQL Data Types
JuniorNot started
PostgreSQL Data Types
Picking the right type: text vs varchar, numeric vs float for money, the all-important TIMESTAMPTZ, JSON vs JSONB, arrays, enums, network types, and custom domains.
01Difference between VARCHAR(n), CHAR(n), and TEXT. Which should you default to?Junior02INTEGER vs BIGINT vs NUMERIC vs DECIMAL vs REAL vs DOUBLE PRECISION — when to use each, especially for money.Mid03TIMESTAMP vs TIMESTAMPTZ — why should you almost always use TIMESTAMPTZ?Mid04Indexing — B-tree, Hash, GIN, GiST, BRIN
MidNot started
Indexing — B-tree, Hash, GIN, GiST, BRIN
How each index type works and what it is for, composite and covering indexes, partial and expression indexes, the cost of indexing, and why the planner sometimes ignores an index.
01How does a B-tree index work? Why is it the default in PostgreSQL?Mid02When is a Hash index useful? Why was it rarely used before PostgreSQL 10?Mid03What is a GIN index used for? (Full-text search, JSONB, arrays.)Mid05Query Planning & EXPLAIN
SeniorNot started
Query Planning & EXPLAIN
Reading EXPLAIN output, the scan and join node types, how the planner chooses between them, finding slow queries with pg_stat_statements, and why Postgres has no planner hints.
01EXPLAIN vs EXPLAIN ANALYZE vs EXPLAIN (ANALYZE, BUFFERS, VERBOSE).Senior02Seq Scan vs Index Scan vs Index Only Scan vs Bitmap Heap/Index Scan.Senior03When does the planner choose Seq Scan over Index Scan?Senior06Transactions, ACID, Isolation Levels
SeniorNot started
Transactions, ACID, Isolation Levels
ACID, the four isolation levels and the anomalies they prevent, what Read Committed actually guarantees, SSI Serializable, MVCC and row versions, and VACUUM and ID wraparound.
01What does ACID stand for? Define each property.Mid02The four isolation levels — what anomalies does each prevent?Senior03The four anomalies: Dirty Read, Non-Repeatable Read, Phantom Read, Serialization Anomaly.Senior07Locks & Concurrency
SeniorNot started
Locks & Concurrency
Table- and row-level lock modes, advisory locks, deadlock detection, investigating contention with pg_locks and pg_stat_activity, and SKIP LOCKED for safe job queues.
01Table-level lock modes — which statements take which?Senior02Row-level locks: FOR UPDATE, FOR NO KEY UPDATE, FOR SHARE, FOR KEY SHARE.Senior03Advisory locks — when are they useful?Mid08Window Functions & Advanced SQL
MidNot started
Window Functions & Advanced SQL
Window vs aggregate functions, ranking and offset functions, frame clauses, CTE materialization (the 12+ change), recursive CTEs, LATERAL joins, DISTINCT ON, and GROUPING SETS.
01Difference between aggregate functions and window functions?Mid02ROW_NUMBER() vs RANK() vs DENSE_RANK().Mid03LAG() and LEAD() — example use cases.Mid09JSON & JSONB
MidNot started
JSON & JSONB
JSONB vs JSON, the access and containment operators, GIN indexing strategies, mutation functions, JSONPath, and when document columns beat normalized tables.
01Difference between JSON and JSONB. Which should you almost always use?Mid02-> vs ->> vs #> vs #>> operators.Mid03@>, <@, ?, ?&, ?| operators — what do they do?Mid10Full-Text Search
MidNot started
Full-Text Search
tsvector and tsquery, building a GIN-backed FTS index, the query-builder functions, ranking, language configurations, and when to reach for a dedicated engine instead.
01What is tsvector and tsquery?Mid02How do you build a full-text index? (GIN on to_tsvector(...).)Mid03@@, plainto_tsquery, phraseto_tsquery, websearch_to_tsquery.Mid11Partitioning
SeniorNot started
Partitioning
Declarative partitioning, range/list/hash strategies, partition pruning, default partitions, live attach/detach, subpartitioning, and the foreign-key and global-index gotchas.
01What is declarative partitioning? When was it introduced?Senior02Range, List, Hash partitioning — when to use each?Senior03Partition pruning — how does the planner skip partitions?Senior12Replication & High Availability
SeniorNot started
Replication & High Availability
Physical vs logical replication, sync vs async streaming, replication lag and slots, WAL, publications/subscriptions, failover tooling, and PgBouncer pooling modes.
01Difference between physical and logical replication.Senior02Streaming replication — synchronous vs asynchronous.Senior03Replication lag — how do you monitor it?Senior13Backup, Recovery, PITR
SeniorNot started
Backup, Recovery, PITR
Logical vs physical backups, pg_dump/pg_dumpall/pg_basebackup, point-in-time recovery and WAL archiving, the ecosystem tools, and why DR testing matters.
01pg_dump vs pg_dumpall vs pg_basebackup. When to use each.Senior02What is PITR (Point-in-Time Recovery)? How does it work?Senior03WAL archiving — archive_command, restore_command.Senior14Performance Tuning & Operations
SeniorNot started
Performance Tuning & Operations
The key postgresql.conf parameters and how to size them, autovacuum tuning, connection pooling, finding slow queries and unused indexes, and CLUSTER/REINDEX/VACUUM FULL locking.
01Key postgresql.conf params: shared_buffers, work_mem, maintenance_work_mem, effective_cache_size, max_connections, random_page_cost.Senior02How do you size shared_buffers and work_mem?Senior03autovacuum tuning — when does it not keep up?Senior15Stored Procedures, Functions, Triggers
MidNot started
Stored Procedures, Functions, Triggers
Functions vs procedures, the procedural languages, volatility categories, trigger types and timing, when triggers become a liability, return shapes, and SECURITY DEFINER.
01Difference between a function and a procedure in PostgreSQL.Mid02Function languages: SQL, PL/pgSQL, PL/Python, PL/V8.Mid03IMMUTABLE vs STABLE vs VOLATILE — what does each mean and how does the planner use them?Senior