Production slow-query logs miss rare paths and cache effects, so profile with SAVEQUERIES
Engineers who fix slow queries from a production log often still see sluggishness that the log never captured. Such logs only record what ran during the sampling window, so they overlook rarely triggered paths, queries whose speed depends on cache state, and regressions introduced after the sample was taken. The suggested remedy is an opt-in profiler built on WordPress's SAVEQUERIES, enabled temporarily so the site can be crawled deliberately on a controlled environment. Because wpdb checks the constant on each query, it can be defined from a mu-plugin rather than wp-config.php, keeping overhead off every request. The author also cautions that comparisons made against unwarmed caches can overstate improvements, so multiple warm runs should be measured before trusting results.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in