Manual:Reduce size of the database
It is possible to reduce the size of the MediaWiki database.
Without destroying data 
Compress page text 
By default, MediaWiki saves text into the database uncompressed. The size of the 'text' table entries for new edits can be reduced by about half by enabling $wgCompressRevisions. This requires PHP to have zlib support enabled, which is usually the case.
Beware that text will be completely unreadable if you later move to a server without the PHP zlib module, or if you are trying to work with wiki page text directly in the database. This may affect some unofficial extensions that attempt to do search-and-replace on existing article text.
See the next section for how to apply compression to existing revisions.
Compress old revisions 
By default, MediaWiki saves a full copy of every version of every page on the wiki, which can add up on frequently-edited pages. You can run the compressOld.php maintenance script to compress, or re-compress, existing text entries in your database.
cd /path/to/wiki/maintenance/storage php compressOld.php
Even if you've been using $wgCompressRevisions for basic compression from the beginning, compressOld can apply the 'concat' or 'diff' compression modes to combine adjacent revisions much more efficiently.
Be aware that these advanced compression modes will also likely be incompatible with some unofficial extensions that attempt to read or write text directly to the database.
By destroying unwanted data 
|Warning:||Permanently removing data from the wiki's database may be harmful to your health. ALWAYS back up your wiki first!|
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 run the deleteArchivedRevisions.php maintenance script
php maintenance/deleteArchivedRevisions.php --delete Delete archived revisions Deleting archived revisions... done. 45560 revisions deleted. Searching for active text records in revisions table...done. Searching for active text records in archive table...done. Searching for inactive text records...done. 45560 inactive items found. Deleting...done.
This will clear out the archive table, where deleted revisions are stored, and will also remove the text of the deleted pages, which makes up the majority of the memory used in the database. If you were to delete entries from the archive table directly (TRUNCATE TABLE archive;), then you would need to use the purgeOldText.php maintenance script to purge linked text records.
- 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.
Please consider your license, as you may not be allowed to do this, while keeping the current versions!
See also 
- Manual:Reduce size of the installation
- Extension:SpecialDeleteOldRevisions2 (Unstable!)