Percona-toolkit usage tutorial-Performance Tools
1. pt-index-usage
Function introduction:
Read the plug-in statement from the log file and explain how they use the index. After the analysis is completed, a report about the index that has not been used for query is generated.
Usage:
Pt-index-usage [OPTION...] [FILE...]
You can obtain the SQL directly from the slow query. The SQL format in the FILE must be the same as that in the slow query. If it is not always necessary, Use pt-query-digest to convert it. You can also save the Report to the database without generating it. For details, see the following example.
Example:
An example of how to view index usage from an SQL statement in full query:
Pt-index-usage/data/dbdata/localhost-slow.log -- host = localhost -- user = root -- password = zhang @ 123
Save the analysis result to the database example:
Pt-index-usage/data/dbdata/localhost-slow.log -- host = localhost -- user = root -- password = zhang @ 123 -- no-report -- create-save-results-database
Use -- create-save-results-database to automatically generate a database and a table to save the results.
2. pt-pmp
Function introduction:
Execute the aggregated GDB stack trace for the query program. The advanced stack trace is used to summarize the tracing information.
Usage:
Pt-pmp [OPTIONS] [FILES]
Example:
Pt-pmp-p 21933
Pt-pmp-B/usr/local/mysql/bin/mysqld_safe
3. pt-visual-explain
Function introduction:
The explain execution plan is formatted and output in tree mode for easy reading.
Usage:
Pt-visual-explain [OPTION...] [FILE...]
For more information about option, see the official website!
Example:
Example of an aaa file containing the explain result:
Pt-visual-explain aaa
Example of viewing aaa files containing query statements:
Pt-visual-explain -- connect aaa -- user = root -- password = zhang @ 123
An example of the explain output result can be directly viewed in a pipeline:
Mysql-uroot-pzhang @ 123-e "explain select email from test. collect_data where id = 101992419" | pt-visual-explain
Percona Toolkit: click here
Percona Toolkit: click here