Open main menu

lensowiki β

Changes

Help:Reduce size of the database

4,390 bytes added, 11:52, 1 July 2006
Compress old revisions
{{H:h|system admin toc}}
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.

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

==Permanently remove the history of deleted pages==
To permanently remove the history of deleted pages, first delete the pages using the [[Help:Administration#Page_deletion|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.

==Permanently remove old revisions==

=== < Mediawiki 1.5beta3 ===
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;

or (which is sometimes '''MUCH''' faster)

TRUNCATE TABLE 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 <nowiki>Special:Recentchanges</nowiki>.

php rebuildrecentchanges.php

=== >= Mediawiki 1.5beta3 ===

* How to do it in this case?
** Currently reported as Bug [http://bugzilla.wikipedia.org/show_bug.cgi?id=3612 3612]
*** The "old" table does not exist any more! How is it possible to remove the whole history. This would be very important, since it would reduce the size of the database significantly. Does a SQL query exist for this task?
**** It's not possible and won't be available in future, because "Wikimedia Foundation tends to need to keep all old revisions for various [judicial] reasons, including GFDL issues (Rob Church)". That's a pity, because it costs much money for new servers to keep up this unnecessary service.
***** External storage space is free for Wikimedia. We have many terabytes of apache hard drive space that we have no other use for. -- [[User:Tim Starling|Tim Starling]] 02:22, 26 February 2006 (UTC)
***Yes, but still it must be possible to remove the old version by a sql query or a php script. Has anyone an idea? Thanks!
**** I opened it as Enhancement Request [http://bugzilla.wikipedia.org/show_bug.cgi?id=4748 4748], I would be interested in this feature very much. The only thing you can use for this is [[Special:Export]] and [[Special:Import]] with setting it to actual version, but you need to specify any article and category you want to export, and after import - in some cases - you need to purge the page. This is a complicated way. --[[User:Wissenslogistiker|Wissenslogistiker]] 15:26, 25 January 2006 (UTC)

Looking into providing a script. [[User:Robchurch|Rob Church]] <sup>''[[User_talk:Robchurch|Talk]]''</sup> 15:23, 25 January 2006 (UTC)

A '''script is available''' at the bug entry [http://bugzilla.wikipedia.org/show_bug.cgi?id=4748 4748]. '''Be careful, save your database before testing it !''' [[User:Zaijian|Zaijian]] 17:11, 5 February 2006 (UTC)

* There is a better solution even: an '''official deleteOldRevisions.php''' in current CVS by mediawiki developer. It reduced size of wiki db from about 60 MB to 15 MB now! I just closed [http://bugzilla.wikipedia.org/show_bug.cgi?id=4748 4748]. But saving your database is a good advice here too. Use following to activate it after setting password in adminsettings.php.

php deleteOldRevisions.php --delete

--[[User:Wissenslogistiker|Wissenslogistiker]] 23:35, 5 February 2006 (UTC)

== Mediawiki 1.6.7. ==

Use [[SpecialDeleteOldRevisions]].
Anonymous user