Courses
SQL Advanced: Queries That Hold Up Under Load
Check Yourself: Concurrency
Five scenario questions on bloat, vacuum, lost updates, deadlocks and lock timeouts. If you miss more than one, reread the lessons in this section.
Course content
Join this Course
Sign in to save your progress.
-
Reading Plans
-
EXPLAIN ANALYZE: Reading a Plan Line by Line
-
Statistics, ANALYZE and Why the Planner Guesses Wrong
-
-
-
Indexes That Earn Their Cost
-
B-tree, Partial and Expression Indexes
-
GIN, GiST and BRIN: When a B-tree Is the Wrong Tool
-
-
-
Concurrency
-
MVCC, VACUUM and Table Bloat
-
Locks, SELECT FOR UPDATE and Deadlocks
-
-
-
Advanced Query Shapes
-
Recursive CTEs and Hierarchies
-
JSONB: Query Semi-Structured Data Without Regretting It
-
-
-
Running It in Production
-
Partitioning Large Tables
-
Changing a Live Table Without Locking It
-
Backup, Restore and Proving the Restore Works
-
-
- Final Check: SQL Advanced
1.
Every row of a 20,000-row table is updated once, and the table grows from 89 to 177 pages. After VACUUM, the file is still 177 pages. Why?
2.
VACUUM finishes, but pgstattuple still reports 20,000 dead rows. Which cause is most likely?
3.
Two checkout sessions each read a stock of 10, subtract 1 in the application, and write 9. Two pens were sold, and the stock says 9. What is the best fix?
4.
The log shows deadlock detected. One transaction updates the pen row and then the mug row, and another updates the mug row and then the pen row. What is the fix?
5.
A migration needs ACCESS EXCLUSIVE on a busy table, and a long report holds a lock on it. What keeps the whole application from stalling behind the migration?
About
Five scenario questions on bloat, vacuum, lost updates, deadlocks and lock timeouts. If you miss more than one, reread the lessons in this section.
- Duration
- 5 min
- Last update
- 09/22/2026
Was this helpful?
0
0
Comments (0)
Sign in to commentNo comments yet.