Courses
SQL Advanced: Queries That Hold Up Under Load
Check Yourself: Advanced Query Shapes
Five scenario questions on the two parts of a recursive CTE, cycles, walking up a tree, JSONB operators and GIN. 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.
What are the two parts of a recursive CTE, and when does it stop?
Two independent queries that run at the same time. It stops after a fixed number of rounds.
An anchor that runs once and a recursive term that runs again on the previous round. It stops when a round returns no rows.
A SELECT and an index. It stops when the index is full.
A parent and a child table. It stops at the end of the table.
2.
An org-chart query with WITH RECURSIVE never finishes. Someone saved a row so that two employees are each other's manager. Which change lets the query end?
3.
You have a category row and want everything above it, up to the top. How does the recursive term join?
4.
WHERE specs -> 'brand' = 'Cebu Co' fails with an invalid JSON error. Why?
5.
A GIN index exists on the payload column, but WHERE payload ->> 'type' = 'refund' still reads the whole table. What are your options?
About
Five scenario questions on the two parts of a recursive CTE, cycles, walking up a tree, JSONB operators and GIN. If you miss more than one, reread the lessons in this section.
- Duration
- 5 min
- Last update
- 09/18/2026
Was this helpful?
0
0
Comments (0)
Sign in to commentNo comments yet.