CertGrid CertGrid
Configuration·MySQL

MySQL Slow Query Log

Off by default, on in one statement, and the field that matters is not `Query_time` but `Rows_examined` - 400,000 rows read to return 1 is the signature of a missing index.

Performance Guide 33 of 45 Intermediate

Written against the versions above. `long_query_time` accepts fractions. The default of 10 seconds is far too high to catch anything on a healthy system - a query taking 10 seconds is already an incident.

Every command on this page ran on db-a01.
Server NameIP AddressOSRolesCPURAMHDD
db-a01192.168.0.81Ubuntu 26.04 LTSPrimary / Source / Replica Set Member 12 Core4 GB50 GB

Before you start

  1. Check whether it is on

  2. Turn it on with a threshold that catches something

  3. Run two queries and read what was recorded

  4. Turn it off again

Official sources