Analyzing slow queries using pt-query-digest

pt-query-digest, which is part of the Percona Toolkit, is used for analyzing queries. The queries can be collected through any of the following:

  • Slow query log
  • General query log
  • Process list
  • Binary log
  • TCP dump

Installation of the Percona Toolkit is covered in Chapter 10Table Maintenance, Installing Percona Toolkit section. In this section, you will learn how to use pt-query-digest. There are drawbacks for each method. The slow query log does not include all queries unless you specify long_query_time as 0, which drastically slows down a system. The general query log does not include query time. You cannot get complete queries from the process list. Only writes can be analyzed using binary log ...

Get MySQL 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.