↑ ↓ select, Enter open, Esc close

Analyze the slow query log for the slowest queries

Adjust the values, the command updates live
root@server
mysqldumpslow -s t -t 10 /var/log/mysql/mariadb-slow.log

Groups queries that differ only in their concrete values and sorts them by total runtime (-s t). It shows the ten most expensive patterns with count, average time and a sample query. This allows targeted optimization instead of chasing individual outliers.

Note: -s c sorts by frequency. SHOW VARIABLES LIKE 'slow_query_log_file'; shows the current log path.

Open question before approval: Prüfen, ob mysqldumpslow bzw. mariadb-dumpslow auf Debian 12 mit MariaDB 10.11 im Paket mariadb-server enthalten ist und welcher Logpfad tatsächlich gesetzt ist.

Also searched as

  • analyze mysql slow query log
  • which queries are the slowest
  • mysql performance analysis

Related one-liners

All in MySQL and MariaDB

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.