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

What are the monitoring indicators of MySQL database?

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

Share

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

This article shows you what the MySQL database monitoring indicators are, which are concise and easy to understand, which can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

1 、 performance_schema

The events_statements_summary_by_digest table of the performance mode holds a number of key metrics, grabbing delay, error, and query volume information related to each standardized statement.

A sample row taken from the table shows that a statement has been executed 18 times, with an average execution time of 2.5 milliseconds (all timers are measured in picoseconds)

Calculate the average elapsed time in microseconds by mode:

SELECT schema_name, SUM (count_star) count, ROUND ((SUM (sum_timer_wait) / SUM (count_star)) / 1000000) AS avg_microsec FROM performance_schema.events_statements_summary_by_digest WHERE schema_name IS NOT NULL GROUP BY schema_name

Calculate the total number of statements with errors by pattern:

SELECT schema_name, SUM (sum_errors) err_count FROM performance_schema.events_statements_summary_by_digest WHERE schema_name IS NOT NULL GROUP BY schema_name;2, sys mode

For special queries or surveys, it is usually easier to use MySQL's sys schema. The sys schema provides a structured set of metrics in a format that is easier for people to read, making the corresponding query simpler.

2.1. Find the slowest statement (the running time is outside 95):

SELECT * FROM sys.statements_with_runtimes_in_95th_percentile

2.2. See which standardized statements have errors:

SELECT * FROM sys.statements_with_errors_or_warnings;3, slow query

In addition to the rich performance data in both performance mode and sys mode, MySQL provides a Slow_queries counter that is incremented whenever the execution time of the query exceeds the value specified by the long_query_time parameter. By default, the threshold is set to 10 seconds.

SHOW VARIABLES LIKE 'long_query_time'

What are the monitoring indicators of MySQL database? have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are 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