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 10, Table 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 and using TCP dump causes server degradation. Usually, this tool is used on the slow query log with a long_query_time of 1...