Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use percona-toolkit performance class tools in mysql

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to use percona-toolkit performance tools in mysql, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1. Pt-index-usage

Function introduction:

Read the query statements from the log file and use explain to analyze how they use the index. After the analysis is completed, a report is generated that the index has not been used by the query.

Usage introduction: pt-index-usage [OPTION...] [FILE...] The sql format in the sql,FILE file can be obtained directly from the slow query. It must be consistent with the slow query.

If you don't always need to use pt-query-digest to convert it. You can also save the report directly to the database without generating a report. For details, see the example below.

Examples of use:

View an example of index usage from sql in a slow query:

Pt-index-usage / data/dbdata/localhost-slow.log-host=localhost-user=root-password=chenfeng@123

Save the analysis results to the database example: pt-index-usage / data/dbdata/localhost-slow.log-host=localhost-user=root-password=chenfeng@123-no-report-create-save-results-database

Using-- create-save-results-database automatically generates databases and tables to save the results.

2. Pt-pmp

Function introduction:

Perform an aggregated GDB stack trace for the query program, an advanced stack trace, and then summarize the trace information.

Usage introduction: pt-pmp [OPTIONS] [FILES]

Use example: pt-pmp-p 21933 pt-pmp-b / usr/local/mysql/bin/mysqld_safe

3. Pt-visual-explain

Function introduction:

The execution plan from the formatted explain is output in tree mode, which is easy to read.

Usage introduction: pt-visual-explain [OPTION...] [FILE...]

Examples of use:

View an example of an chenfeng file that contains explain results:

Pt-visual-explain chenfeng

View an example of an chenfeng file that contains query statements:

Pt-visual-explain-connect chenfeng-user=root-password=chenfeng@123

An example of viewing the explain output directly through the pipeline:

Mysql-uroot-chenfeng@123-e "explain select email from test.collect_data where id=10485790" | pt-visual-explain

These are all the contents of this article entitled "how to use percona-toolkit performance tools in mysql". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report