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

Example Analysis of Performance_schema SQL execution Statistics in Mysql

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly shows you the "sample analysis of Performance_schema SQL execution statistics in Mysql", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let me lead you to study and study the "sample analysis of Performance_schema SQL execution statistics in Mysql".

View the most frequently executed TOP SQL:

Can solve the problem:

Number of times 1.SQL is executed

two。 Full table scan

3. Temporary watch

Select digest_text as sql_text,count_star as exec_count,if (sum_no_good_index_used > 0 or sum_no_index_used > 0,'*',') as full_scan,sum_created_tmp_tables as tmp_tables

Sum_created_tmp_disk_tables as tmp_disk_tables

Sum_sort_rows as rows_sorted from events_statements_summary_by_digest where schema_name='ticket' and digest_text like 'select%' order by count_star desc limit 10

Generate mysql sql execution performance report

Enable performance collection of SQL

Use performance_schema

Update setup_consumers set enabled='YES' where name IN ('events_statements_history','events_statements_current','statements_digest')

Clear SQL performance data

Truncate table events_statements_current

Truncate table events_statements_history

Truncate table events_statements_summary_by_digest

Do sleep (60)

Statistics on the proportion of SQL execution

Select now (), (count_star/ (select sum (count_star) FROM events_statements_summary_by_digest) * 100) as pct, count_star as sql_exec, left (digest_text,150) as stmt, digest from events_statements_summary_by_digest order by 2 desc

Turn off performance collection for SQL:

Update setup_consumers set enabled='NO' where name IN ('events_statements_history','events_statements_current','statements_digest')

The above is all the contents of the article "sample Analysis of Performance_schema SQL execution Statistics 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