# How to Triage a MySQL Slow Query Log Safely

https://ferkesh.net/knowledgebase/article/mysql-slow-log-aggregate-triage

![Workflow: Choose a narrow window; Group recurring shapes; Investigate one candidate; Measure the result.](https://ferkesh.net/kb-media/ferkesh-guide-diagrams-batch-14.svg#mysql-slow-log-aggregate-triage)

A slow-query log can contain sensitive SQL and values. Work from an authorized short sample and focus on the workloads that contribute the most delay.

## Procedure

1. **Choose a narrow window.** Ask the database owner for an approved sample, threshold and retention period. Record affected routes and workload conditions without changing production logging on your own.
2. **Group recurring shapes.** Use redacted query patterns to compare count, duration and examined rows. A moderately slow frequent query may consume more total time than the single slowest example.
3. **Investigate one candidate.** Reproduce it safely on representative staging data. Compare the query plan and lock evidence separately, and check whether the application repeats unnecessary work.
4. **Measure the result.** Validate rows, latency and resource impact after the staged change. Save only redacted findings and rerun the same comparison after release.

## Related guides

- [How to Read MySQL EXPLAIN for a Slow SELECT](https://ferkesh.net/knowledgebase/article/mysql-explain-select-on-staging)
- [How to Investigate MySQL and MariaDB Lock Waits](https://ferkesh.net/knowledgebase/article/mysql-mariadb-lock-wait-incident)
- [Developer Resources articles](https://ferkesh.net/knowledgebase/category/developer-resources)

## Official references

- [MySQL slow query log](https://dev.mysql.com/doc/refman/8.4/en/slow-query-log.html)

Ferkesh Hosting. Last reviewed November 26, 2026.
