Site AI AuditInternet Solutionsilt

WordPress Database Cleanup: Safe Steps for Better Performance

31. august 20267 min lugemistVeebisaidi kiirus
WordPress Database Cleanup: Safe Steps for Better Performance

Short answer: A WordPress database accumulates post revisions, expired transients, spam and trashed comments, leftover tables and options from removed plugins, and oversized autoloaded options. Cleaning these up can speed up the admin area and uncached pages. The safest approach is to take a full backup, check the size of autoloaded options first, delete expired transients, trash and spam, limit post revisions, remove data left by plugins you have uninstalled, and only then optimise tables. Never delete data you do not understand.

Every WordPress site stores its content, settings and much of its plugin data in a MySQL or MariaDB database. On a new site the database is small and fast. After a few years of publishing, editing, installing and removing plugins, running a shop or collecting form submissions, it can grow many times larger than the content it actually serves. Most of that growth does not hurt; databases handle large tables well. But certain kinds of clutter are read on every request and do slow things down. Knowing which is which keeps you from risky cleanups that achieve nothing.

When database size actually affects speed

A big database is not automatically a slow one. What matters is what is read on each request and whether queries can use indexes. Problems usually show up as:

If your cached pages are fast and the admin feels normal, database cleanup is housekeeping, not a speed project. If uncached requests are slow, the database is a good place to look.

Step 1: Back up before anything else

Take a complete database backup, and confirm you can restore it, before running any cleanup. Download a copy off the server. Many hosts offer one-click backups and staging; use a staging copy for larger cleanups. Database changes cannot be undone with the WordPress trash, and one wrong query can remove orders, users or settings.

Step 2: Check autoloaded options

The wp_options table holds site settings and plugin data. Options marked for autoloading are loaded into memory on every single request, whether the page needs them or not. Plugins sometimes store large amounts of data there: logs, caches, statistics, license checks. Plugins you removed years ago may have left their options behind.

Autoloaded data is the single database issue most likely to affect every request, so it deserves attention before anything else.

Step 3: Remove expired transients

Transients are temporary cached values with an expiry time, stored in the options table unless you use an object cache. WordPress deletes expired transients during regular maintenance, but on some sites they pile up, particularly when scheduled tasks do not run reliably. Deleting expired transients is safe; plugins recreate them when needed. If you use a persistent object cache such as Redis, transients live there instead of the database.

Step 4: Limit and clean post revisions

WordPress saves a revision every time you save a post, which is valuable for undoing mistakes but adds up on sites with long, frequently edited pages or page builders that store large content.

Step 5: Empty trash, spam and orphaned data

Step 6: Remove leftover tables from old plugins

Many plugins create their own tables and leave them behind after uninstalling. Leftover tables do not slow down queries to other tables, but they increase backup size and clutter. Identify them by their prefix and name, confirm the plugin is truly gone and not just deactivated, and remove them only after a backup. If you are unsure what a table belongs to, leave it.

Step 7: Optimise tables and check the engine

What is safe to clean and what is not

ItemUsually safe?Notes
Expired transientsYesRecreated automatically when needed
Spam and trashed commentsYesCheck nothing important was misfiled as spam
Old post revisionsYes, beyond a limitKeep recent ones for recovery
Options from removed pluginsUsuallyConfirm the plugin is gone; back up first
Leftover plugin tablesUsuallyOnly when you know which plugin owned them
Orders, customers, usersNoBusiness and legal records; never bulk-delete
Unknown options or tablesNoLeave them until you know what they are

A realistic cleanup session

For a typical company site that has been running for five years or more, a cleanup session might go like this. After a backup, Site Health reports a large amount of autoloaded data. The listing shows that most of it belongs to a statistics plugin removed two years ago and a slider plugin that is still active but stores its whole configuration in one autoloaded option. The first is deleted; for the second, the plugin’s settings allow switching off an unused feature that shrinks the stored data. Next, several thousand expired transients and a few thousand spam comments are removed. A revision limit is set, and old revisions beyond it are cleaned. Finally, a security plugin’s log table that had grown to millions of rows gets a retention period of thirty days. The whole session takes an hour, the admin post list opens noticeably faster, and uncached pages generate more quickly. None of the steps touched content, users or orders.

Keep it tidy automatically

How Site AI Audit helps

Site AI Audit measures your site from the outside, including how quickly the server responds, and runs Google PageSpeed for mobile. A slow response on pages that should be fast is a sign to look at the server side, including the database. The report explains findings in plain words and ranks them by impact, so you know whether database work should come before images or scripts. Run a free check first.

Related reading

The bottom line

Database cleanup helps when uncached requests or the admin area are slow, and the biggest win is usually oversized autoloaded options rather than raw table size. Back up first, clean autoloaded data, expired transients, excess revisions, spam and leftovers from removed plugins, and set up retention limits so the clutter does not return. Leave anything you do not understand.

KKK

Does cleaning the WordPress database make the site faster?

It can speed up the admin area and uncached pages, mainly by reducing autoloaded options and clutter read on each request. Cached front-end pages usually see little difference. Measure before and after to confirm the effect on your site.

Is it safe to use a database cleanup plugin?

Reputable cleanup plugins are generally safe for standard items like expired transients, spam and revisions. Always take a full backup first and avoid options that delete data you do not understand. Test on staging for larger cleanups.

What are autoloaded options in WordPress?

They are entries in the options table that WordPress loads into memory on every request. Small amounts are normal, but plugins can store large data there, which slows every page. Site Health and profiling tools help identify the largest ones.

How many post revisions should WordPress keep?

There is no single right number, but a limit such as five to ten per post keeps useful history without unlimited growth. Set it with the WP_POST_REVISIONS constant in wp-config.php.

Should I delete tables left by old plugins?

Only if you are certain which plugin created them and that it is no longer used. Leftover tables mostly affect backup size, not speed. When in doubt, keep them.

#Page speed#Web hosting#WordPress performance
Kontrollige oma veebisaiti — tasuta.Mida veebisaidil parandada — ja millest alustada.
Alusta tasuta

Veel blogist

Kõik artiklid →
Internet Solutions

Veel meie meeskonnalt

Loonud Internet Solutions. Proovige ka meie teisi tooteid — iga üks säästab aega omal moel.

internet-solutions.net ↗
Site AI Audit
Privaatsuse ülevaade

See veebisait kasutab küpsiseid, et saaksime pakkuda teile parimat võimalikku kasutajakogemust. Küpsiste teave salvestatakse teie brauserisse ja see täidab selliseid funktsioone nagu teie äratundmine, kui naasete meie veebisaidile, ning aitab meie meeskonnal mõista, millised veebisaidi osad on teile kõige huvitavamad ja kasulikumad.