Manual:Reduce size of the database

It may be possible to reduce the size of the database.

Permanently remove the history of deleted pages
To permanently remove the history of deleted pages, first delete the pages using the normal page deletion feature.

Then clear out the archive table, where deleted revisions are stored, at the database level:

DELETE FROM archive;

Of course, it will then no longer be possible to view and restore deleted pages and their history.

Permanently remove old revisions
To permanently remove the histories of all current pages clear out the old table, where old revisions are stored, at the database level:

DELETE FROM old;

Be absolutely sure you don't want any of your pages' histories, though, as that information will be completely and permanently blown away by this. All prior versions will be gone entirely; they will not appear in 'History', will not appear in 'User contributions', cannot be viewed, diffed, or reverted to.

If you insist on doing this it is very strongly recommended to back up your database first in case you need to reference an older version later (or you just make a mistake!).

You can rebuild the index of recent changes to ensure that old entries no longer appear in Special:Recentchanges.

php rebuildrecentchanges.php