Listing the most offending querys in MySQL

4

I would like to know which are the most offensive queries in my database.

I have already used the conventional "Show full processlist" and other methods.

    
asked by anonymous 25.07.2017 / 19:21

1 answer

2
  

You can use the query below:

select * from sys.'x$statement_analysis'

It will bring a lot of information about the most executed query, latency, average latency, number of times it was run, affected rows, among a lot of other information.

  

Remembering that the MySQL server has to be configured to parse this data.

To enable MySQL Server, edit the my.cnf file and verify that the settings are as described below:

performance_schema_consumer_events_statements_history_long=ON
performance_schema_consumer_events_statements_history=ON
performance_schema_consumer_events_stages_current=ON
performance_schema_consumer_events_stages_history=ON
performance_schema_consumer_events_stages_history_long=ON
performance_schema_consumer_events_waits_current=ON
performance_schema_consumer_events_waits_history=ON
performance_schema_consumer_events_waits_history_long=ON

performance_schema=ON

performance_schema_instrument='%=ON'

Source: link

    
25.07.2017 / 20:06