Understanding the causes.
THE MAIN CAUSES
Missing indexes on tables that have grown
Bloat: revisions, transients, logs, spam
Queries loading enormous result sets Too many queries per page Autoloaded data in WordPress, loaded on every request Table locking under concurrent writes
THE PATTERN
A site that was fast and is now slow almost always has a table that grew past the point where an unindexed query remains acceptable.
A query scanning a thousand rows is instant. The same query scanning a million is not.
WHAT MAKES IT WORSE
Every page load running the full application, because caching is not enabled.
A cached page does not query the database at all, which is why caching is the single largest improvement available.
FINDING THE CAUSE
A query monitoring plugin during a page load shows every query, its time, and what triggered it.
The slow query log captures the worst offenders over time.
THE ORDER OF FIXES
Enable caching Clean bloat Add indexes where queries are slow Reduce the number of queries per page