Book Image

Mastering MariaDB

By : Federico Razzoli
Book Image

Mastering MariaDB

By: Federico Razzoli

Overview of this book

Table of Contents (19 chapters)
Mastering MariaDB
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Explaining the pt-query-digest command from Percona Toolkit


The pt-query-digest command is a tool included in the Percona Toolkit project (formerly known as Maatkit). This command can read the queries from the slow query log, general query log, binary log (to be discussed later), and SHOW PROCESSLIST statement.

To use pt-query-digest, Percona Toolkit needs to be installed. The package is included in several Linux distributions. The latest version can be downloaded from Percona's website as the .deb or .rpm package. It is compatible with all versions of MariaDB and MySQL starting from MySQL 5.0. It does not work on Windows and requires Perl.

Usually, we prefer to analyze the slow query log first because the queries it contains are likely to be problematic. This is what we will do in the next example. We have not discussed the slow log yet but it does not matter much. A user can just pass pt-query-digest, which is the name of the general query log, instead of the slow log. We will not discuss...