WebGee Docsالتوثيق
WordPress

Optimise your WordPress database

Clear out post revisions, auto-drafts, spam and transients with the LiteSpeed Database Optimizer, and know which options are safe to run.

WordPress databases accumulate data that is never read again — old post revisions, abandoned drafts, expired transients, deleted comments. Clearing it reduces database size and speeds up queries. Applies to all shared and reseller hosting, which runs LiteSpeed.

The Database Optimizer is part of the LiteSpeed Cache plugin, so if the plugin is installed you already have it. See Install and enable LiteSpeed Cache.

Take a backup first. Every option here deletes data permanently, and there is no undo. See Download a backup of your account.

Open it

In the WordPress dashboard, go to LiteSpeed CacheManage, then the DB Optimizer tab.

Blue check marks mean an area is already clean. Red crosses mean there is something to remove.

What each option removes

OptionRemovesSafe to run
Post RevisionsEvery saved revision, leaving the published versionYes, if you do not need edit history
Auto DraftsAutomatic drafts WordPress saves while editingYes
Trashed PostsPosts and pages in the TrashYes, once you have checked the Trash
Trashed CommentsComments in the TrashYes
Spam CommentsComments marked as spamYes
Trackbacks & PingbacksTrackback and pingback recordsYes
Expired TransientsCached values whose lifetime has passedYes
All TransientsEvery transient, expired or notYes, but see below
Optimize TablesNothing — reclaims space inside the tablesYes
Clean CSS/JS OptimizerMinified and combined CSS/JS dataYes

Clean All runs everything except Optimize Tables and Clean CSS/JS Optimizer. Run those two separately.

The two worth thinking about

Post Revisions is usually the largest single saving. WordPress keeps every revision of every post forever, so a heavily edited site can hold ten times more revision rows than published content. The cost is that you lose the ability to roll a post back to an earlier draft.

To keep some history rather than none, cap revisions in wp-config.php instead of deleting them repeatedly:

define( 'WP_POST_REVISIONS', 5 );

All Transients deletes cached values that have not yet expired. Nothing breaks — WordPress regenerates them on demand — but the next few page loads are slower while it does, and some plugins store licence checks and API responses as transients. Prefer Expired Transients for routine cleaning.

Do this periodically, not constantly

Once a month is ample for most sites. Running it daily produces no measurable benefit and repeatedly rewrites the tables.

If the database is still large after cleaning, the size is in real content or in plugin tables the optimiser does not touch — commonly logging, analytics or form-submission plugins storing rows indefinitely. Check those plugins' own retention settings.

Verify

  • The DB Optimizer tab shows blue check marks where it showed red crosses.
  • The site loads normally, including a logged-out page and the dashboard.
  • Database size in cPanel has dropped, after running Optimize Tables — until then the rows are deleted but the space is not reclaimed.

On this page