Performance module Free feature

Database optimisation

Runs OPTIMIZE TABLE across your WordPress tables, reclaiming fragmented space and rebuilding indexes.

What it does

Compacts what deletion left behind

Database optimisation is a Vectro performance feature that runs OPTIMIZE TABLE on your WordPress database tables to reclaim fragmented space and rebuild indexes after rows have been deleted.

Deleting rows from a database does not immediately shrink the file that holds them. The space is marked reusable but the table stays fragmented, and indexes can end up less efficient than when they were built. OPTIMIZE TABLE is the MySQL operation that rebuilds a table to fix both.

This feature runs it on every table that uses your WordPress table prefix, as part of a cleanup run. It changes no data – every row that existed before still exists afterwards. Only the physical arrangement on disk changes.

It pairs naturally with Database cleanup. Cleanup removes the rows, optimisation compacts what is left.

Why it matters

Fragmentation builds up where churn is highest

The tables that churn most are the ones that matter most. wp_options is read on every request. wp_postmeta grows and shrinks constantly as plugins write and remove data. After months of revisions being created and cleared, and transients expiring, those tables carry gaps that make sequential reads less efficient than they should be.

Optimising rebuilds them compactly. On a site with a long history the file size reduction alone can be substantial, which makes backups faster and migrations less painful – benefits that show up well beyond page load time.

Rebuilds every WordPress table
Covers every table with your WordPress table prefix, including tables added by plugins, with no need to select them individually.
Reclaims real disk space
Where cleanup frees rows logically, optimisation returns the space and shrinks the file.
No data is changed
Every row survives. Only the physical layout on disk is rebuilt.
Can be slow on large databases
InnoDB rebuilds in place. On a multi-gigabyte database this takes time, so avoid running it at peak traffic.

How to use it

Clean first, then optimise

1
Run Database cleanup first
Optimising before removing junk rebuilds the junk too. Clear the disposable rows, then compact what remains.
2
Take a database backup
OPTIMIZE TABLE is a safe operation, but any bulk table action is worth backing up before, particularly on a large database.
3
Open the Performance module
Go to Vectro > Performance in wp-admin.
4
Choose a quiet moment
On a large InnoDB database the rebuild can take a while and the tables are locked during it. Avoid your busiest hours.
5
Turn on Optimise Database Tables, then click Run Cleanup Now
Optimisation runs after the cleanup categories in the same pass. The result lists how many tables were optimised.

Technical detail

What OPTIMIZE TABLE actually does

On MyISAM tables, OPTIMIZE TABLE defragments the data file and sorts the index pages. On InnoDB, which is the default storage engine for modern WordPress, MySQL maps the command to an in-place table rebuild followed by an index rebuild and a statistics refresh.

That in-place rebuild is why timing matters. The operation is safe, but it is not instant on a large table and it holds locks while it runs. On a small site it completes in seconds; on a large store it can take considerably longer.

Command
OPTIMIZE TABLE on every table with your WordPress table prefix.
Trigger
The Optimise Database Tables toggle, off by default. It runs with Run Cleanup Now and with Scheduled cleanup.
InnoDB behaviour
Mapped to an in-place rebuild plus index rebuild and statistics refresh.
MyISAM behaviour
Defragments the data file and sorts index pages.
Data safety
No rows are added, removed or altered.
Locking
Tables are locked during the rebuild. Avoid running at peak traffic.
Best paired with
Database cleanup, run immediately before.

Compatibility

Vectro detects these and steps aside

WP-Optimize
Vectro defers table optimisation to WP-Optimize when it is active.

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 optimisation do?

Vectro database optimisation runs OPTIMIZE TABLE across your WordPress database tables, which reclaims fragmented space and rebuilds indexes after rows have been deleted. No data is added, removed or altered by the operation.

Does Vectro database optimisation work with WP-Optimize?

No – if WP-Optimize is active, Vectro detects it and disables its own table optimisation automatically. WP-Optimize handles table optimisation instead, so the two never run against the same tables.

How do I optimise my WordPress database tables in Vectro?

Go to Vectro > Performance in wp-admin, turn on Optimise Database Tables, save, then click Run Cleanup Now. Vectro runs the cleanup categories first and optimises the tables afterwards in the same pass.

Is Vectro database optimisation free or Pro?

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

Is it safe to run OPTIMIZE TABLE on a large WordPress database?

It is safe, but on InnoDB tables MySQL performs an in-place rebuild that locks the table while it runs, which can take a long time on a multi-gigabyte database. Run it outside your peak traffic hours and take a backup first.

Related features

The full database routine

Vectro Pro adds a database size tracker with historical graphs to monitor growth over time. 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