PostgreSQL transactions and performance
Understand isolation, locks, index tradeoffs and query plans.
Use database invariants and transactions rather than trusting concurrent client operations.
Interview questions
Choose a question to reveal its answer.
01EasyCoreWhat does atomicity mean in database transactions?
Answer
What does atomicity mean in database transactions?
All operations in a transaction commit as a unit or none take effect after rollback.
Save a test attempt and related updates together.
BEGIN;
UPDATE study_progress SET completed = true
WHERE user_id = $1 AND topic_slug = $2;
COMMIT;Bind both parameters in the application, enforce ownership, and roll back on failure.
02MediumCoreWhat does consistency mean in the ACID properties?
Answer
What does consistency mean in the ACID properties?
A correctly designed transaction preserves defined database constraints and invariants from one valid state to another.
Reject a test record with more correct answers than total questions.
03MediumCoreHow does isolation affect concurrent transactions?
Answer
How does isolation affect concurrent transactions?
It controls how concurrent operations interact and which anomalies can occur under a given isolation level.
Prevent a concurrency anomaly when two workers update a shared quota.
04EasyCoreWhat does transaction durability guarantee?
Answer
What does transaction durability guarantee?
Committed changes survive failures within the guarantees of the configured database and storage system.
A saved test remains after a database process restarts under durable configuration.
05HardHigh priorityHow does PostgreSQL MVCC support concurrent reads and writes?
Answer
How does PostgreSQL MVCC support concurrent reads and writes?
It maintains row versions and snapshot visibility rules so many readers can see a consistent snapshot without blocking writers.
Read a consistent set of records while another transaction modifies them.
06MediumHigh priorityHow does PostgreSQL Read Committed isolation work?
Answer
How does PostgreSQL Read Committed isolation work?
Each statement sees committed data as of its own snapshot, with specified behavior for concurrent updates.
Two successive SELECT statements may observe newly committed changes.
07HardHigh priorityWhat guarantees does Serializable isolation provide?
Answer
What guarantees does Serializable isolation provide?
Successful concurrent transactions have an outcome consistent with some serial order; serialization failures may require a complete retry.
Protect a multi-row invariant from write-skew anomalies.
08MediumWhat is a database deadlock and how can you handle it?
Answer
What is a database deadlock and how can you handle it?
Transactions wait cyclically for locks held by one another; the database aborts one participant, which can be retried appropriately.
Acquire shared resources in a consistent order to reduce deadlocks.
09MediumWhen is a B-tree index useful?
Answer
When is a B-tree index useful?
It commonly supports equality, ordered and range queries; performance depends on selectivity and query structure.
Retrieve a user's recent attempts using an index on owner and timestamp.
10HardHow do you read EXPLAIN ANALYZE safely?
Answer
How do you read EXPLAIN ANALYZE safely?
Inspect estimated and observed rows, scan choices and timings; the ANALYZE option actually executes the statement.
Analyze a SELECT query for inaccurate row estimates and expensive scans.
Priority and difficulty are editorial study recommendations.
Technical reference: Documentation / paper ↗
Try a few practice questions
Explore the questions before creating a free account.