Manual:Reduce size of the database

It is possible to reduce the size of the database.

NOTE: Please see Extension:SpecialDeleteOldRevisions2 (deletes old revisions, reduces DB size by more than 90% in some cases)

Only in MediaWiki 1.2 and 1.3
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.

(Q: "difficult" as in you'll have to do some sql manipulation? or difficult as in computationally expensive?)

Note: Doesn't exist in MediaWiki 1.13+

Newer versions
cd /path/to/wiki/maintenance/storage php compressOld.php

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;

or (which is sometimes MUCH faster)

TRUNCATE TABLE archive;

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

Note: while this will remove the history or archived files and access to it, it will NOT remove the text for the deleted pages, which makes up the majority of the memory used in the database. The text of the deleted pages is stored in the text table together with the text from the non-deleted pages.

Extensions

 * Extension:SpecialDeleteOldRevisions2 can drastically reduce the size of the database, more than 90% in some cases. It deletes old revisions of all articles, or in certain namespaces, or with titles matching a certain string. Optionally a cut date can be defined, so that older revision are deleted, and newer are kept. Page histories will be lost and only the current version (or recent versions since the cut date) of any article will be saved in the database. --Wikinaut 00:07, 29 December 2009 (UTC)