patternsqlMinor
MySQL Slow Query Log - SELECT /*!N SQL_NO_CACHE */
Viewed 0 times
logqueryslowmysqlsql_no_cacheselect
Problem
Using
I can't seem to find much information about what this statement means and whether I need to worry about it enough to try and track down where WordPress is creating this SQL.
mysqldumpslow, I can see that the most common entries in a MySQL slow query log are of the following form:SELECT /*!N SQL_NO_CACHE */ from wp_posts (or wp_comments).I can't seem to find much information about what this statement means and whether I need to worry about it enough to try and track down where WordPress is creating this SQL.
Solution
These types of SELECT are always performed by mysqldumps.
If you look in the slow log for the start time of the query and the time of each of these SELECTs is the same time every day, it is definitely coming from a mysqldump you have crontab'd somewhere.
To eliminate this, you may need to run this
Then go run the mysqldumps, and then run
This should totally eliminate this type of SELECT from landing needlessly in the slow log.
If you look in the slow log for the start time of the query and the time of each of these SELECTs is the same time every day, it is definitely coming from a mysqldump you have crontab'd somewhere.
To eliminate this, you may need to run this
SET GLOBAL slow_query_log = 'OFF';Then go run the mysqldumps, and then run
SET GLOBAL slow_query_log = 'ON';This should totally eliminate this type of SELECT from landing needlessly in the slow log.
Code Snippets
SET GLOBAL slow_query_log = 'OFF';SET GLOBAL slow_query_log = 'ON';Context
StackExchange Database Administrators Q#3824, answer score: 7
Revisions (0)
No revisions yet.