Backend concept

SQL Indexes

Single-column indexes, composite indexes, leftmost prefix rules, covering indexes, and write overhead.

Practice this concept Review missed items Back to concept map

Key takeaway

Single-column indexes, composite indexes, leftmost prefix rules, covering indexes, and write overhead. Start with the related games below when you want to turn the definition into practice.

Why this matters

Indexes are one of the highest leverage tools for making backend queries predictable under load.

How to practice

Match equality filters, sort order, range predicates, and selected columns deliberately.

0 active misses 0 reviewed 0 games completed

Local review for this concept

No local review items for this concept yet.

Start a focused review session for SQL Indexes.

Learning objectives

  • Choose indexes that match filters and ordering.
  • Apply the leftmost prefix rule for composite indexes.
  • Recognize when an index is low-value or creates unnecessary write overhead.
  • Compare estimated and actual plan rows.
  • Connect selectivity to scan and join choices.
  • Validate query changes across representative workloads.

Common mistakes to avoid

  • Indexing a low-cardinality boolean column by itself and expecting a large speedup.
  • Creating composite indexes in the wrong column order.
  • Ignoring ORDER BY and then paying for a separate sort.
  • Reading cost as elapsed milliseconds.
  • Adding indexes without checking selectivity.
  • Validating only one parameter value.

Games for SQL Indexes

Start with the first game, then use local review history to revisit missed decisions.

Databases Intermediate

SQL Index Quest

Choose the best database index for simplified schemas and queries while learning full scans, covering indexes, sort avoidance, and composite order.

Time
7-10 minutes
Concept
Database indexing and query performance
  • Data & Performance
  • Algorithmic Reasoning
  • SQL
  • indexes
  • performance
Play SQL Index Quest
Databases Advanced

Query Plan Investigator

Investigate PostgreSQL query plans, cardinality gaps, scan choices, join amplification, and rollout evidence.

Time
9-12 minutes
Concept
SQL query planning and cardinality
  • Data & Performance
  • SQL Indexes
  • Performance
  • Databases
Play Query Plan Investigator
Reliability Advanced

Slow Query & Change War Room

Triage blocking chains, slow-query regressions, expand-contract changes, and resource-safe database rollouts.

Time
10-12 minutes
Concept
Production database incident response
  • Data & Performance
  • Databases
  • Incidents
  • Schema Migrations
Play Slow Query & Change War Room
Spring Advanced

Spring Data Boundary Clinic

Place Spring transactions, JPA fetch plans, rollback rules, and validated configuration at production boundaries.

Time
9-11 minutes
Concept
Spring transaction and data boundaries
  • Spring Production
  • Transactions
  • SQL Indexes
  • Spring
Play Spring Data Boundary Clinic
Databases Intermediate

Schema Migration Runbook

Choose safe zero-downtime database migration steps for expanding schemas, backfilling data, rolling out indexes, enforcing constraints, and recovering from failures.

Time
6-9 minutes
Concept
Zero-downtime schema migration planning and expand-contract releases
  • Data & Performance
  • Database Reliability
  • migrations
  • schema design
  • backfill
Play Schema Migration Runbook
Databases Advanced

Transaction Isolation Arena

Defend database invariants from concurrent requests by choosing transactions, locks, constraints, snapshot reads, and optimistic concurrency.

Time
7-10 minutes
Concept
Database transactions, isolation anomalies, locks, and invariant protection
  • Data & Performance
  • Database Reliability
  • SQL
  • transactions
  • isolation
Play Transaction Isolation Arena