RANIARANIA Academy

Indexes & Query Performance

Learn to diagnose and speed up slow PostgreSQL queries. You will understand how B-tree and other index types work, read EXPLAIN and EXPLAIN ANALYZE plans to find the real bottleneck, and design composite, partial and covering indexes while keeping tables healthy with VACUUM and ANALYZE.

Watch the free preview

Why queries get slow — the sequential scan — free to watch, no account needed.

PostgreSQL INTERMEDIATE · 150 min · Certificate on completion · 3 CPD points

What you'll learn

  • Diagnose and speed up slow queries using indexes and query plans
  • Explain how a B-tree index works and why it turns a scan into a lookup
  • Choose the right index type — B-tree, Hash, GiST, GIN or BRIN — for a workload
  • Read EXPLAIN and EXPLAIN ANALYZE output to locate the bottleneck in a plan
  • Design composite, partial and covering indexes and keep them healthy with VACUUM and ANALYZE

Syllabus

How Indexes Work
Why queries get slow — the sequential scanFree preview15 min
The B-tree — how an index turns a scan into a lookup15 min
Index Types and Creating Them
Beyond B-tree — Hash, GiST, GIN and BRIN15 min
Creating indexes safely in production15 min
Reading Query Plans with EXPLAIN
EXPLAIN — reading the plan the planner chose15 min
EXPLAIN ANALYZE — measuring what actually happened15 min
Advanced Indexing and Maintenance
Composite, partial and covering indexes15 min
Keeping performance healthy — VACUUM and ANALYZE15 min
Lab — 10 Exercises & Solutions
Exercises 1–515 min
Exercises 6–1015 min