Slow Query Log Analyzer
A slow query log is almost never a list of different problems: it is the same handful of statements repeated with different literals. This analyzer reads a MySQL or MariaDB slow query log, a PostgreSQL log written by log_min_duration_statement, or a plain list of statements, replaces every literal with a placeholder so that executions of the same statement collapse into one shape, and ranks those shapes by the total time they consumed. For each shape you get call count, average, minimum and maximum duration, the rows examined to rows sent ratio that exposes missing indexes, lock wait share, and a sample of the original statement, plus follow-up SQL for EXPLAIN ANALYZE, pg_stat_statements and performance_schema. Parsing happens entirely in your browser; the log never leaves the page.
Do more than slow query log analyzer — meet Chat2DB
Chat2DB is an AI-powered SQL client for Windows, macOS and Linux. Write SQL in natural language, format and optimize queries automatically, and manage MySQL, PostgreSQL, Oracle and 20+ other databases in one workspace.
How to use
- Paste the contents of your slow query log, or a section of it, into the log box. Leave the format on Auto-detect unless the log has an unusual prefix.
- Sort by total time to find the query that costs the most wall clock overall, or by rows examined to find the ones scanning the most data, and raise the minimum duration to drop noise.
- Take the top shape into EXPLAIN ANALYZE using the generated follow-up SQL, then confirm the ranking with pg_stat_statements or performance_schema before you add an index.
Frequently asked questions
Why group queries by shape instead of reading the log line by line?
Because ranking raw log lines answers the wrong question. A report that runs once and takes 12 seconds looks worse than a query that takes 80 milliseconds, but if that second query runs 40,000 times an hour it is consuming far more of the server. Replacing literals with placeholders turns both into a single row each, so you can compare them on total time, which is the number that predicts how much load you remove by fixing one of them. This is the same normalisation that pg_stat_statements does with queryid and that MySQL performance_schema does with digest_text; doing it in the browser just lets you apply it to a log file you already have, including logs from servers where those features are not enabled.
What does a high rows examined to rows sent ratio mean?
It means the server read a large number of rows to produce a small result, which is the clearest signal a log can give that an index is missing or unusable. If a query examines 2.8 million rows and sends 25, the engine scanned a table or a large index range and threw almost everything away. Common causes are a WHERE column with no index, a leading-wildcard LIKE, a function wrapped around an indexed column such as DATE(created_at) = ..., an implicit type conversion between a string column and a numeric literal, or an ORDER BY that cannot use the same index as the WHERE clause. Postgres logs do not include the row counters, so the ratio only appears for MySQL and MariaDB logs; for Postgres use EXPLAIN (ANALYZE, BUFFERS) and compare the estimated and actual row counts instead.
Is my slow query log uploaded anywhere?
No. The parsing, normalisation and aggregation all run as JavaScript in this page, so the text you paste stays in the browser tab and is discarded when you close it. That matters because slow query logs contain production literals, including email addresses, identifiers and sometimes tokens embedded in WHERE clauses. If you want to go from the ranked list to the actual database, Chat2DB can connect to MySQL, PostgreSQL and other engines to run EXPLAIN, inspect indexes and test a fix: download it at https://chat2db.ai/download or use the web version at https://app.chat2db.ai.
