Courses
SQL Advanced: Queries That Hold Up Under Load
Check Yourself: Reading Plans
Five scenario questions on filters, loops, stale statistics, dependent columns and EXPLAIN ANALYZE on data changes. 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.
In a plan, a Seq Scan node shows Rows Removed by Filter: 18400 and returns 1,600 rows. What does that tell you?
2.
A node under a SubPlan shows actual rows=2500 and loops=8. How many rows did that node return in total?
3.
Right after a bulk load, EXPLAIN shows an estimate of 90 rows for a filter that really returns 600. The table was never analyzed. What is the first thing to try?
4.
Each warehouse belongs to exactly one region. The query filters on warehouse W03 and region R02, and the planner expects 100 rows while 1,000 come back. What is the cause and the fix?
The planner multiplies the two shares as if the columns were independent. Declare the dependency with CREATE STATISTICS and run ANALYZE.
PostgreSQL cannot estimate a filter on two columns. Use only one column in the query.
The table is too small. Add more rows until the estimate improves.
The estimate is wrong because autovacuum is on. Turn it off.
5.
You want to see the real plan of a DELETE on the production server. Which way is safe?
About
Five scenario questions on filters, loops, stale statistics, dependent columns and EXPLAIN ANALYZE on data changes. If you miss more than one, reread the lessons in this section.
- Duration
- 5 min
- Last update
- 09/24/2026
Was this helpful?
0
0
Comments (0)
Sign in to commentNo comments yet.