KakapoWPKakapoWP
Log inTry for free
Help Center/Performance/Database cleanup — what gets deleted

Database cleanup — what gets deleted

Applies to: Kakapo Performance·5 min read

The “Database” (in German: „Datenbank“) panel counts the entries in your installation that can be cleaned up and removes them at the press of a button. The counting is harmless, the cleanup is not: the affected entries are deleted directly from the database and do not end up in the trash. So read first what disappears in the process.

What “Clean up now” deletes irreversibly

  • Post revisions: all revisions of all posts, including those of the post you are working on right now. Earlier versions cannot be brought back afterwards.
  • Auto-drafts: all entries with the status auto-draft.
  • Posts in the trash: every entry with the status trash is deleted permanently, regardless of the content type, so pages as well. The trash is empty afterwards and its contents are gone.
  • Spam comments: they are deleted from the comments table, not moved to the trash.
  • Comments in the trash: likewise deleted permanently.
  • Expired transients: cached values whose expiry time has passed. They are generated anew by WordPress and plugins when needed.
The plugin does not create a backup before deleting and has no undo function. If you are unsure, back up the database beforehand with a tool of your choice.

Count first, then clean up

  1. The “Database” (in German: „Datenbank“) item is in the sidebar as the first entry of the “Optimization” (in German: „Optimierung“) group.
  2. Click on “Count again”. The table below shows for each type how many entries would be affected.
  3. Pay particular attention to the “Post revisions” and “Posts in the trash” rows; that is where the things you might miss are hiding.
  4. Only once the numbers look right to you: click “Clean up now” and confirm the prompt.
  5. In the “Optimize tables” card, the button of the same name runs OPTIMIZE TABLE over all tables with the table prefix of this installation and frees up occupied space.

Limiting new revisions

The “Limit revisions” switch only affects future saves. Per post, at most as many revisions are kept as are set under “Keep revisions”; the default is 5, allowed are 0 to 100, and 0 means that no new revisions are saved at all any more. The switch has no influence on revisions that already exist; those are removed by the cleanup alone, and completely.

Letting it clean up automatically

  1. In the same panel, scroll to the “Automatic cleanup” card.
  2. Switch on “Schedule active”; the first run is set for an hour later.
  3. Under “Frequency”, choose daily or weekly; the default is weekly.
  4. The foot of the card then shows the next scheduled run, otherwise the note that the schedule is inactive.
The scheduled run deletes the same things as “Clean up now” and optimizes the tables afterwards, without any further prompt. It hangs on WP-Cron: if the pseudo cron is switched off in the “Cron & Heartbeat” panel and no real system cron is running, no automatic cleanup takes place either.

Every click on “Count again” and every cleanup run adds a data point to the history. From two points onwards, the “Reports” panel draws the bars of the “DB ballast history” card from them.

Was this article helpful?