Skip to content
Go back

The query that scans twelve million orders

Read an execution plan and add one composite index that matches the production query's filter and sort.

The incident you will investigate

This lab runs in a simulated terminal in your browser. No account, cloud resources, or live cluster is required. Inspect the evidence, diagnose the cause, apply a fix, and verify the result.

environment
production replica
workload
mysql/commerce
status
latency degraded
symptom
tenant order lookup performs a full table scan

What you will practice

The order history endpoint exceeds its SLO after data growth. Database CPU is high, but only one query dominates the slow log.

Inspect the execution plan on the read replica before proposing an index.

Try: mysql -e 'EXPLAIN ANALYZE SELECT * FROM orders WHERE tenant_id=42 ORDER BY created_at DESC LIMIT 50;'

Related labs