Sometimes you forget about what you did years ago, for example
the ability of mysqlnd write back traces of slow queries into the
PHP error log . Regardless if you use mysqlnd with ext/mysql,
ext/mysqli or PDO_MYSQL, mysqlnd is able to tell you which of
your code has executed a slow query. To enable the feature, you
need to compile PHP with CFLAGS="-D A0"
.
A0
? Yeah, we must have had some doubts about the
usefulness.
Slow queries
The MySQL server is capable of monitoring queries and recording slow queries in a slow query log. MySQL can log the following types of queries:
- SQL statements that took more than
long_query_time
seconds to execute - SQL statement that required at least
min_examined_row_limit
rows to be examined (MySQL 5.1.21+) - SQL statement …