Interview practice question
Querying deep category trees
Backend Engineering · Relational Databases · Experienced
Your product categories form a tree several levels deep, and loading all descendants of a category is slow. How would you model and query it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Adjacency list with recursive CTE.
- Materialised path (ltree).
- Closure table.
- Nested sets for read-heavy.
- Choose by read/write patterns.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.