Listing the most offensive querys in Mysql

Asked

Viewed 849 times

4

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

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

  • 2

    offending? I’m sorry, I’m not familiar with the term, what does that mean?

  • 1

    Also not familiar with the term @Guilhermenascimento, but I think he meant more "heavy", which consume more processing resources and etc...

1 answer

3

You can make use of the query below:

select * from sys.`x$statement_analysis`

It will bring you information about which query is most executed, latency, average latency, number of times it was executed, affected lines, among a lot of other information.

Remembering that the Mysql server has to be configured to analyze this data.

To enable Mysql Server edit my.cnf file and make sure 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: https://runops.wordpress.com/2015/08/12/mysql-performance-schema/

  • 2

    Only as reference: https://runops.wordpress.com/2015/08/12/mysql-performance-schema/ (link in English)

  • Leonan, in fact I took this query in the own Workbench in the performance area analitics.

  • 2

    The article is only to complement. If you have a time it gives a complement of how to activate, not all server see with this option enabled. Mainly site hosting.

  • Aah yes thanks :) I thought you said I found there kkk

Browser other questions tagged

You are not signed in. Login or sign up in order to post.