Slow database queries are one of the most common causes of WordPress performance problems — especially slow admin dashboards. Every WordPress page load may trigger 50-200+ database queries, and if any are unoptimized, the entire page slows down proportionally.
Most common causes we diagnose:
Systematic, fast, and safe process:
In my.cnf/mysqld.cnf: set slow_query_log=ON, long_query_time=1. Then analyze with: mysqldumpslow -s t /var/log/mysql/slow.log | head -20
Run these for common missing indexes: ALTER TABLE wp_postmeta ADD INDEX meta_value(meta_value(191)); ALTER TABLE wp_options ADD INDEX autoload_option_name (autoload,option_name);
Run: wp transient delete --all && wp post delete $(wp post list --post_status=auto-draft --format=ids) && wp db optimize
Our WordPress expert responds in minutes.
Size alone is not the issue — query efficiency is. A well-indexed 10GB database can perform faster than a poorly indexed 500MB one. However, databases over 1GB with unoptimized queries do become noticeably slow.
No — database cleaning removes only technical overhead: old post revisions, expired transients, orphaned meta. Your posts, pages, products, and users are completely unaffected.
We use Query Monitor (WordPress) or New Relic to break down request time by phase: PHP execution vs database queries vs HTTP/external. If queries account for >40% of page load, the database is the bottleneck.
A slow query is a single inefficient SQL statement. A slow database is overall: many queries are slow because of poor indexes, oversized tables, missing optimization, or insufficient server resources. Both need different fixes.
Enable MySQL slow_query_log with long_query_time=1. After running normal traffic for 24 hours, the log shows every query over 1 second. We use mysqldumpslow to summarize the worst offenders.
Massive. A query scanning 100,000 rows without an index takes 5+ seconds; with the right index it takes under 10ms. We identify missing indexes via EXPLAIN and add them safely without locking tables.
wp_postmeta grows 5-20x larger than wp_posts (ACF, Yoast, custom fields all add rows). Without composite indexes on (post_id, meta_key), queries scan millions of rows. We add the indexes WordPress doesn't include by default.
Yes — significantly. wp_options autoload entries are loaded into memory on every WP request. If autoload data exceeds 1MB (transients, expired sessions), every request becomes 100-300ms slower.
Yes for write-heavy workloads (WooCommerce). InnoDB has row-level locking vs MyISAM table-level locking. We migrate tables with `ALTER TABLE ... ENGINE=InnoDB` after backing up.
Yes. A query without LIMIT scanning huge tables can consume all MySQL connections and memory, blocking every other request. We identify and fix or remove the bad query.
MySQL 8.x and MariaDB 10.5+ have significant performance improvements over older versions: better query optimizer, hash joins, invisible indexes. Upgrading from MySQL 5.6 to 8.0 often gives 20-40% query speed improvement.
Reduces but not replaces. Redis caches results of repeated queries. But uncached queries still hit the database, so optimization still matters. We do both: optimize queries AND add object caching.
Common growth sources: post_revisions (configure WP_POST_REVISIONS limit), expired transients (WP_CRON cleanup), spam comments, action_scheduler tables (WooCommerce), and analytics plugin data. We clean each source.
Most operations: yes. CHECK TABLE and OPTIMIZE TABLE on InnoDB tables run online. ALTER TABLE for adding indexes is online in MySQL 5.6+. Major repairs may need brief maintenance windows.
Six layers: 1) regular OPTIMIZE TABLE schedule, 2) revision/transient cleanup automation, 3) slow_query_log monitoring with alerts, 4) limit autoloaded options, 5) periodic plugin audit (remove inefficient ones), 6) sufficient innodb_buffer_pool_size.
WordPress site suddenly slow? We diagnose performance bottlenecks and restore your speed.
Response in minutes. No data loss. No diagnosis charge.
wpfix.blimx.com