There is a feature in MySQL to log all queries that take longer
than long_query_time to execute, and optionally also log the
queries that don't use indexes. If you are not familar with it, I
recommend reading this page in our manual.
One issue to be aware of, is that some queries may take much
longer than long_query_time to execute, but will not show up in
your slow query log. The manual gives a very good explaination
for this;
The time to acquire the initial table locks is not counted as execution time.
There are two status variables that may help in seeing if you are
hitting read/write concurrency issues because of table-level
locking;
mysql> show global status like 'Table_locks%'; +-----------------------+-------+ | Variable_name | Value | …[Read more]