ANALYZE for statements: MariaDB’s hidden gem
summary
MariaDB’s ANALYZE for statements actually runs the query, discards results and reports r_rows and r_filtered so you can compare estimates vs reality; ANALYZE FORMAT=JSON adds r_loops and r_total_time_ms showing where time is spent (example: many tiny index lookups causing 1.5M loops and 3.5s read time). Overhead is typically under 10% (worst artificial case 10%); rerun ANALYZE TABLE if stats are missing; wrap in BEGIN; ROLLBACK; to avoid changes.
AI-written summary · about
chapters (22)
- 0:00Intro
- 0:16ANALYZE for statements
- 0:57The plan
- 1:13Background: EXPLAIN
- 2:21ANALYZE vs EXPLAIN
- 2:55Tabular ANALYZE statement
- 4:11Interpreting r_rows (2)
- 5:41Interpreting r_filtered
- 6:54r_filtered and query plans
- 7:40Tabular ANALYZE summary
- 8:01Basics
- 9:11A complex query: join
- 10:30A complex query: subquery
- 12:51Sorting (2)
- 13:11ANALYZE and UPDATES
- 13:53Overhead of ANALYZE
- 14:43ANALYZE and slow query log
- 16:12ANALYZE FORMAT=JSON Summary
- 16:42EXPLAIN ANALYZE in MySQL 8
- 19:36Handling for UPDATE/DELETE
- 20:01MySQL's EXPLAIN ANALYZE summary
- 21:11Final conclusions
