Loading lesson…
Level 1 · Apprentice0 XP
B-trees, composite index order, covering indexes and the cost of every index.
Step 1 / 6
ProblemLogging in looks up a user by email in a 20-million-row table without an index. The database reads every row. Each login takes two seconds and the CPU is at 100%.
← → step
Before this: Modelling data for an application
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Load 5 million generated orders, time a lookup by customer with and without a composite index, then try both column orders. Check pg_stat_user_indexes for unused indexes.