O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Slow query log

Enabling and configuring the slow query log is explained in Chapter 12, Managing Logs, Managing the general query log and slow query log. Once the slow query log is enabled and queries are collected, you can run pt-query-digest by passing the slow query log.

Suppose the slow query file is at /var/lib/mysql/mysql-slow.log:

shell> sudo pt-query-digest /var/lib/mysql/ubuntu-slow.log > query_digest

The digest report contains queries ranked by the number of query executions multiplied by the query time. Query details such as the query checksum (a unique value for each type of query), average time, percentage time, and number of executions are shown for all queries in the summary. You can drill down to the specific query by searching ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required