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)
Contents |
[edit] Without destroying data
[edit] 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.
[edit] 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.
[edit] By destroying unwanted data
| Permanently removing data from the wiki's database may be harmful to your health. ALWAYS back up your wiki first! |
[edit] 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.
| 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. |
To remove the text records that are still unused, you can use the purgeOldText.php maintenance script:
$ php maintenance/purgeOldText.php --purge Searching for active text records in revisions table...done. Searching for active text records in archive table...done. Searching for inactive text records...done. 0 inactive items found.
[edit] 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.
[edit] See also
| Language: | English |
|---|