WordPress

Safe WordPress database cleanup

Measure autoloaded options, revisions and orphaned plugin data on a clone before deleting anything.

By AppLaunch Editorial · Reviewed 2026-08-25

Direct answer

Do not delete by table-name guesswork. Back up and restore first, identify the owning plugin or core feature, measure whether the data affects performance, and test cleanup on a clone. Some “orphaned” options are required for reinstall or recovery.

What this means in plain English

A WordPress database collects revisions, temporary values and plugin data, but rows that look old are not automatically safe to delete. Identify which plugin or core feature owns them and measure whether they actually cause a problem.

Back up and restore before cleanup, then work on a clone. Prefer the plugin’s supported cleanup method. Serialized settings can be damaged by direct editing, and a removed plugin may still hold information needed for reinstallation or records.

Which database rows are safe to remove?

OwnershipCore, active plugin, removed plugin or unknown
ImpactSize, autoload behaviour and query frequency
RollbackVerified database restore

A simple example

A large options table contains one plugin’s huge autoloaded setting, which is read on every request. Fixing that known item improves pages. Deleting thousands of unknown rows because they “look unused” adds risk without evidence.

What to do, step by step

  1. 1. Measure tables and large autoloaded options.

    Start here before buying anything or changing several settings at once. It gives you a clear starting point based on ownership: core, active plugin, removed plugin or unknown. Write the result down so you can compare it later.

  2. 2. Map prefixes and keys to owners.

    Use the same files, versions and settings that the real project will use. A quick test with an empty or different setup can look successful while completely missing the problem you are trying to solve.

  3. 3. Use supported cleanup paths where available.

    Try the busiest realistic situation, not the easiest one. Include the people, data, traffic or background work you genuinely expect, then watch for slowdowns and errors rather than relying on a single headline number.

  4. 4. Compare site behaviour and query metrics after cleanup.

    Finish by checking the result against rollback: verified database restore. Keep the old setting or release available until you know the change works and can be reversed safely.

One more useful tip

Measure database and page behaviour before and after. A smaller file is not automatically a faster website.

Common mistakes and how to avoid them

Deleting every transient during live traffic.

This gives a misleading or unsafe result because it leaves out ownership. A better approach is to measure tables and large autoloaded options, then check the result before making the change permanent.

Removing unknown serialized options.

This gives a misleading or unsafe result because it leaves out impact. A better approach is to map prefixes and keys to owners, then check the result before making the change permanent.

Optimizing row count without performance evidence.

This gives a misleading or unsafe result because it leaves out rollback. A better approach is to use supported cleanup paths where available, then check the result before making the change permanent.

Words explained

WordPress
A content management system that lets people edit pages and posts through an administration screen.
plugin
An add-on that gives WordPress extra features. Every plugin also adds code that must be updated and checked.

Quick checklist

  • Measure tables and large autoloaded options.
  • Map prefixes and keys to owners.
  • Use supported cleanup paths where available.
  • Compare site behaviour and query metrics after cleanup.

Common questions

What is the simple answer?

Do not delete by table-name guesswork. Back up and restore first, identify the owning plugin or core feature, measure whether the data affects performance, and test cleanup on a clone. Some “orphaned” options are required for reinstall or recovery.

What should I check first?

Start with ownership: core, active plugin, removed plugin or unknown. That is usually more useful than choosing from a marketing label or copying somebody else’s setting.

How can I make the change safely?

Measure tables and large autoloaded options. Then change one thing at a time, keep a backup or old version, and use the same real-world test after each change.

What is the easiest mistake to avoid?

Deleting every transient during live traffic. Avoiding that one mistake makes the rest of the comparison much more trustworthy.

Primary sources

  1. WordPress backups — WordPress.org
  2. WordPress Site Health — WordPress.org