Finding and fixing slow database work: reading EXPLAIN plans, choosing indexes, the slow query log, avoiding N+1 queries and keeping wp_postmeta and the other big tables under control.
Remove WordPress database bloat including orphaned postmeta rows, unlimited post revisions, expired transients, and spam comments with safe SQL queries and WP-CLI commands.
Find and fix oversized autoloaded options Every WordPress request starts by loading all options marked as autoload = 'yes' in one query. They are kept in memory (in the object cache under the key alloptions), so later get_option() calls for them cost nothing. The problem is that plugins create options with autoload on by default,…
Make secondary WP_Query loops cheaper: no_found_rows, cache flags and fields A default new WP_Query() does more than select posts. It also counts all matching posts for pagination (SQL_CALC_FOUND_ROWS plus SELECT FOUND_ROWS()), loads the meta of all found posts into the cache and loads their terms. For the main query of an archive that is what…