MySQL Performance Optimization: Diagnosing Gradual Query Slowdown with EXPLAIN, Composite Indexes & Online DDL Safety
This comprehensive guide walks through a complete MySQL performance optimization cycle: classifying three types of gradual slowdown, setting up slow logs and digest metrics, using EXPLAIN ANALYZE and optimizer trace to pinpoint a full-table scan on a 62M-row orders table, adding a composite index (user_id, status, created_at) via safe online DDL with three safety barriers, and establishing monitoring to prevent regression.
