Just as the title says, where can I see it ?

Are there any config options for it ( like how many ms would determine if a query is slow or not ) ?


You can find it in the default directory, depending on your install. For instance, on my Red Hat, it's /var/log/mysql/

Query time is time, in seconds, over which it should start recording. This can be done at startup and at runtime.

log-slow-queries = /var/log/mysql/mysql-slow.log

long_query_time = 1

  • 5
    At my site, I discovered someone has set log_slow_queries=ON. So I have a file in my datadir called ON containing the log. That was confusing...
    – Gaius
    Jan 3 '11 at 22:01
  • 6
    Note that log-slow-queries is deprecated as of 5.1.29. The one to use thereafter is slow-query-log.
    – Riedsio
    Jan 13 '11 at 22:19
  • 1
    Also note that beginning with MySQL 5.1.21, a resolution of microseconds is supported when logging to a file.
    – Riedsio
    Jan 13 '11 at 22:25

In MySQL : show global variables like '%slow%';

Update : here's a link to the manual: link text

  • 1
    Can you link to the manual for a short answer like this? Jan 12 '11 at 1:59

These are the pertinent options (and settings) I generally have/use in all my my.cnfs to log slow queries:


Note that for long_query_time,

Beginning with MySQL 5.1.21 ... a resolution of microseconds is supported when logging to a file.


Search your mysqld config file (usually, /etc/my.cnf)

At your shell:

grep slow /etc/my.cnf

Here is something to consider as well :

If you use the option


in you /etc/my.cnf file, look for the slow log to be a CSV storage engine based table located in, of all places, the mysql schema.

This affects the general log as well, once you enable it.

  • Can you log slow queries to table but the "normal" log into a file?
    – surfmuggle
    Nov 11 '20 at 20:31
  • @surfmuggle Yes you can. If you put log-output=FILE,TABLE. that would do it !!! You must restart mysql to implement this. Nov 11 '20 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.