WordPress Database Bloat: Revisions, Transients, and Autoload
Wordpress database bloat: database growing and the site slowing down? Find the real sources: revisions, transients, autoloaded options.
The daily backup that used to take seconds now takes minutes. The admin feels heavy, and the host starts sending warnings about disk or memory use. When you check, the database is hundreds of megabytes even though the site does not have that many articles.
Database bloat grows quietly. No error message, no broken page—just a slowdown that is invisible at first and then becomes a complaint. And like most cumulative problems, the fix is not a magic button but understanding what is piling up. Leave time to check database before calling wordpress database bloat done.
Short answer: measure first. Open phpMyAdmin or a database panel, look at table sizes, and sort from largest. In almost every case the culprits are wp_posts (full of revisions), wp_options (transients and autoload), wp_postmeta, and log tables created by plugins. Once you know what is large, clean it with a backup as a safety net and without deleting data still in use.
Wordpress database bloat: The most common sources of bloat
Before deleting anything, understand what each table does. Every one may still hold something important.
Post revisions (wp_posts). Every time you press Save, WordPress stores a new version as a revision. An article edited dozens of times can leave dozens of rows. Revisions are useful for comparing changes, but without a limit they become a burden.
Autosaves. A process that saves drafts every few minutes. Old autosaves are not always cleaned, especially when editing happens in long sessions.
Transients (wp_options). Temporary data with an expiry. Plugins use them for caching, API results, and short-lived state. The problem: expired transients are not deleted immediately—they are cleared when accessed or when cron runs. Sites with broken cron can accumulate tens of thousands of transients.
Autoloaded options. Some rows in wp_options are marked autoload = yes, meaning they load on every page request. If a plugin stores large data as autoload, the whole site slows with no visible cause.
Orphaned metadata (wp_postmeta, wp_usermeta). Rows pointing at posts or users that no longer exist. They are rarely large individually, but can number in the tens of thousands.
Plugin log tables. Security, form, and analytics plugins often keep their own logs. These can become the largest tables in the database after a few months.
Leftovers from removed plugins. Some plugins do not clean up their tables when deactivated. The data stays forever.
Wordpress database too large: measure before cleaning
This is the most skipped step and the most decisive. Without measurement you cannot tell whether cleaning worked.
In phpMyAdmin, open the database and view the table list with sizes. Alternatively, run a query showing size per table:
SELECT table_name,
ROUND((data_length + index_length) / 1024 / 1024, 2) AS size_mb
FROM information_schema.tables
WHERE table_schema = DATABASE()
ORDER BY size_mb DESC;
Record the result before and after cleaning. That difference is real evidence, not a feeling that it “seems faster”.
For more specific checks:
SELECT COUNT(*) FROM wp_posts WHERE post_type = 'revision';
SELECT COUNT(*) FROM wp_options WHERE option_name LIKE '_transient_%';
SELECT COUNT(*) FROM wp_options WHERE autoload = 'yes';
Those numbers tell you within seconds whether the problem is revisions, transients, or autoload.
Delete post revisions safely, without breaking the site
Revisions are the easiest to handle because their nature is clear. Two approaches:
Limit them from now on. Add to wp-config.php:
define('WP_POST_REVISIONS', 5);
WordPress then keeps only the last five revisions per article. That stops the problem from growing back.
Clean what already exists. With WP-CLI:
wp post delete $(wp post list --post_type=revision --format=ids) --force
Or with a database cleaning plugin that previews before deleting.
Important cautions before deleting revisions:
- Back up the database first. A revision may hold the only copy of text that was never saved as the final version.
- Make sure the selection is only
post_type = revision. A query that accidentally targetspost_type = postremoves every article. - Do not delete revisions while an author is editing. They may lose the ability to compare changes.
After cleaning, wp_posts can shrink dramatically. The database file on disk will not shrink immediately, though—OPTIMIZE TABLE is needed to reclaim space, and that is best done when the site is quiet.
Autoload options bloat: transients and the options table
Transients are temporary, but deleting all of them carelessly can hurt. If you remove transients still in use, plugins recreate them—harmless, but a temporary load spike. What should be cleaned are expired transients.
WP-CLI offers a safe route:
wp transient delete --expired
To see how many exist:
wp transient list --format=count
More important is autoload. Check which options load on every page and how large the total is:
SELECT SUM(LENGTH(option_value)) AS bytes
FROM wp_options WHERE autoload = 'yes';
If that number is large—hundreds of kilobytes or more—every page request carries that weight. Common causes: a plugin storing large configuration data, or transients marked autoload when they do not need to be.
Do not change autoload values manually without understanding them. Safer: find the plugin responsible, update or replace it, then delete expired transients. If you must change it manually, do it one row at a time with notes and a backup.
Log tables and plugin data
Log tables are often the largest and the safest to clean—provided you know the retention policy.
What to check:
- Security plugins store failed login attempts. If bots scan often, this table grows fast.
- Form plugins store submission entries. That is customer data—never delete without the owner’s approval.
- Analytics plugins store visits. Often they can be trimmed by date range.
- Backup plugins store history. It can be cleared after a new backup is verified.
Before cleaning, ask: is this data still needed for audit, reporting, or legal retention? Deleted security logs can destroy evidence if an incident happens later. Conversely, a two-year-old log nobody reads is pure weight.
Rule of thumb: set a retention window, for example 30–90 days, then clean on schedule—not once in a panic.
Wordpress database bloat: Orphaned metadata and plugin remnants
Orphaned metadata means rows in wp_postmeta or wp_usermeta pointing at objects that no longer exist. They are usually small, but the row count can hurt query performance.
Cleaning them demands care, because not every “parentless” row is garbage. Some plugins store data with custom conventions that do not follow standard patterns. A bulk delete query can remove data still in use.
A safer approach: use a cleaning plugin that previews results, and inspect a few examples before deleting. On sites with important integrations—online stores, memberships, subscriptions—do it on staging first.
Remnants of removed plugins usually appear as tables prefixed with the plugin name. Do not delete them just because the name is unfamiliar; first check whether another plugin uses them.
When to ask for help
Some situations make manual cleaning risky:
- The database is gigabytes and cleaning through phpMyAdmin keeps timing out.
- The site holds transaction, membership, or integration data tied to specific tables.
- The site runs in an environment without verified backups.
- The cause of the bloat is still unclear after measuring.
In those cases, cleaning should happen through the CLI, with a full backup, inside an agreed maintenance window. For sites taking orders, do not experiment with queries during peak hours.
Preventing the next round
Once the database is back to a reasonable size, keep it from growing again:
Wordpress database bloat returns quietly, so a quarterly size check is what keeps it visible.
- Cap revisions with
WP_POST_REVISIONS. - Make sure cron runs, since transient cleanup depends on it—see WP-Cron not running.
- Set log retention for security, form, and analytics plugins.
- Avoid plugin overload, especially ones storing large data per visit.
- Monitor database size monthly, not yearly.
- Test backup restores regularly, because a large backup you cannot restore is worthless.
- Record schema changes when installing or removing plugins.
For sites publishing daily, revisions and transients are the two main sources. A monthly check is enough to prevent surprises.
Wordpress database bloat: what matters first
A growing database is almost always revisions, transients that never get cleaned, and autoloaded options loaded on every page. Measure which table is large before deleting anything; cleaning without measurement is guessing, and deleting active transients slows the site. Wp-config.php sometimes still holds a pending problem.
Frequently asked questions
Does deleting revisions remove my articles? No, as long as you only delete post_type = revision. Posts and pages stay intact. Still take a backup before running any query.
Will deleting transients slow the site down? Temporarily, because plugins must rebuild their caches. The point is to delete expired transients, not every active one.
Why does the database size not drop after cleaning? The database file does not shrink automatically. OPTIMIZE TABLE reclaims space, and it is best run when the site is quiet.
Are database cleaning plugins safe? Many are, when they preview results and you review the selection. What is dangerous is deleting everything marked “optimize” without reading the list.
If your database is already large or the site has started to slow, accurate measurement is worth more than blind cleaning. A free audit can map the largest tables and their causes, while monthly website care includes routine checks so the problem does not return.
Read next: WordPress 403 Forbidden Error: Find What Is Blocking You, WordPress Plugin Not Showing in the Plugin List, WP-Cron Not Running: Scheduled Posts and Tasks Fail.
Does any of this look like your website?
Tell us on WhatsApp. We look first, explain what needs fixing, then you decide. For a fuller picture, request the free audit.
Related articles.
WordPress 403 Forbidden Error: Find What Is Blocking You
Wordpress 403 forbidden error: a WordPress 403 usually comes from server rules, not from WordPress. Panduan praktis yang bisa dipakai hari ini.
WordPress Plugin Not Showing in the Plugin List
Wordpress plugins not showing in list: uploaded a plugin but it is missing from the list? Check the file header, folder nesting, permissions.
WP-Cron Not Running: Scheduled Posts and Tasks Fail
Wp-cron not running wordpress: scheduled posts not publishing or automatic tasks stalled? Understand how WP-Cron really works, why it fails.