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.
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.
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