Manual:Reduce size of the database

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

Compress old revisions
cd /path/to/wiki/maintenance php compressOld.php

In MediaWiki 1.2 and 1.3, this will reduce the size of the old table (which is typically the bulk of the database) by about 50%. In MediaWiki 1.4, it will typically reduce the size of the old table by about 85%, but at the expense of making it difficult to delete existing articles.

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