1

We are facing a critical issue for past two days with slow queries with mysql in our Prod Env (mostly myisam tables older ones)

Right now we are tracking process list,cpu usage etc through nagios.

Is it possible to track a slow query issue occurs and occupies the whole of the memory and stops other queries to get passed on.

Need clarification on how to handle slow queries in Live ENV's and how to get notified on the same.

sikar
  • 41
  • 5

2 Answers2

0

Are you using the mysql slow query log? It does just that, logs the exact mysql that is slow. You haven't mentioned this, it may be what you are looking for?

https://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html

The server uses the controlling parameters in the following order to determine whether to write a query to the slow query log:

The query must either not be an administrative statement, or --log-slow-admin-statements must have been specified.

The query must have taken at least long_query_time seconds, or --log-queries-not-using-indexes must have been specified and the query used no indexes for row lookups.

The query must have examined at least min_examined_row_limit rows.

Then you'd go about optimizing by doing the EXPLAIN route and all that.

Paul Stanley
  • 4,018
  • 6
  • 35
  • 56
0

We use OpsDash to track slow queries and send us alerts on a Slack channel. As mentioned in the other reply, the definition of "slow" can be specified in the conf file.