Database Cleanup

Performance module Free feature

Database cleanup

Removes seven categories of accumulated database waste in one operation, so queries run against a smaller table set.

What it does

Seven kinds of waste, one operation

Database cleanup is a Vectro performance feature that removes post revisions, auto-drafts, trashed posts, spam comments, expired transients and orphaned post meta from your WordPress database in a single operation.

WordPress keeps a great deal that it never deletes. Every time you save a post it stores another full revision. Deleted posts and comments sit in the trash indefinitely. Plugins write transients with expiry times and then leave the expired rows behind. Post meta belonging to deleted posts is frequently orphaned rather than removed.

This feature clears all seven categories in one pass: post revisions, auto-drafts, trashed posts, spam comments, trashed comments, expired transients and orphaned post meta. The first six each have their own toggle, and orphaned post meta is always cleared. Revisions are the one you tune – by default it keeps the five most recent per post so you do not lose your editing history.

It removes rows that WordPress itself considers disposable. Published content, pages, media and settings are untouched.

Why it matters

A bloated wp_posts table slows every page

Revisions live in the same wp_posts table as your published content. A site with 300 posts edited a dozen times each is carrying several thousand extra rows, and every query that touches wp_posts pays a cost for them. Expired transients pile up in wp_options, a table WordPress queries on every request.

The effect is not dramatic on a small site, but it compounds. Databases get slower gradually, backups take longer, and migrations become unwieldy. Clearing rows that serve no purpose is the cheapest performance work available, because nothing has to be rewritten or reconfigured to benefit from it.

Seven categories at once
Revisions, auto-drafts, trashed posts, spam comments, trashed comments, expired transients and orphaned meta.
Revision retention you set
Keeps the five most recent revisions per post by default so you do not lose your editing history.
Clears expired transients
Rows that plugins left in wp_options after their expiry passed, along with their timeout rows.
Published content is untouched
It only removes rows WordPress already treats as disposable. Posts, pages, media and settings stay.

How to use it

Back up first, then run it

1
Take a database backup
This deletes rows permanently. Run a backup before the first cleanup, even though the categories removed are ones WordPress considers disposable.
2
Open the Performance module
Go to Vectro > Performance in wp-admin.
3
Set how many revisions to keep
The default is 5 per post, and Revisions to Keep accepts 0 to 50, where 0 deletes every revision. Set it higher if you rely on revision history, or lower on a site where posts are rarely edited.
4
Review the counts before running
The top of Vectro > Performance shows how many revisions, auto-drafts, trashed posts, spam comments and expired transients you have, plus your database size.
5
Click Run Cleanup Now
Every category you have switched on runs immediately. To repeat it automatically, enable Scheduled cleanup instead of running it by hand.

Technical detail

What is deleted, precisely

Vectro issues targeted DELETE statements against wp_posts, wp_comments, wp_options and wp_postmeta, scoped by post type and status so nothing outside the listed categories is affected. Revisions are ordered by date and only those beyond your retention count are removed. While Clean Post Revisions is on, Vectro also sets WordPress’s own revision limit to the same number, so posts never store more revisions than that in the first place.

Deleting rows frees them logically but does not always return disk space to the operating system, because InnoDB keeps the freed pages for reuse. Run Database optimisation afterwards if you want the file size to come down as well.

Post revisions
Removed beyond your retention count, default 5 per post.
Auto-drafts
Removed. These are abandoned drafts WordPress created automatically.
Trashed posts
Removed, along with their post meta.
Spam and trashed comments
Removed. Comment meta rows are not touched.
Expired transients
Removed from wp_options, together with their timeout rows.
Orphaned post meta
Meta rows whose parent post no longer exists. Always cleared, with no separate toggle.
Disk space
Rows are freed logically. Run Database optimisation to reclaim file size.

Compatibility

Vectro detects these and steps aside

WP-Optimize
Vectro stops cleaning post revisions and leaves them to WP-Optimize. The other cleanup categories still run.

You can override any automatic deferral from the Compatibility panel in Vectro’s dashboard if you would rather Vectro handle it.

Questions

Frequently asked

What does Vectro database cleanup remove?

Vectro database cleanup removes post revisions beyond your retention setting, auto-drafts, trashed posts, spam comments, trashed comments, expired transients and orphaned post meta. It does not touch published posts, pages, media or plugin settings.

Does Vectro database cleanup work with WP-Optimize?

Partly. If WP-Optimize is active, Vectro detects it and stops cleaning post revisions and optimising tables, leaving those to WP-Optimize. Auto-drafts, trashed posts, spam and trashed comments, expired transients and orphaned post meta are still cleared by Vectro.

How do I clean my WordPress database with Vectro?

Go to Vectro > Performance in wp-admin, set how many post revisions to keep, then click Run Cleanup Now. Take a database backup first, because the rows are deleted permanently.

Is Vectro database cleanup free or Pro?

Yes, Vectro database cleanup is free. It is included in the free Vectro plugin on WordPress.org with no account required.

Will database cleanup delete my published posts?

No – database cleanup only removes rows WordPress already treats as disposable, such as revisions, auto-drafts and trashed items. Your published posts, pages, media and settings are never affected.

Related features

Keep the database lean

Vectro Pro adds scheduled backups so your clean database is protected before every cleanup. See Pro plans

Download Vectro free on WordPress.org

27 features across Security, Performance and Maintenance. No account required, no expiry, unlimited sites.

Scroll to Top