Manual:Old table/en

The old table is where MediaWiki versions up to MediaWiki 1.4 store historical versions of articles. These MediaWiki versions store the current version of articles in the  table. Most fields of the old table correspond to the same fields in the table.

In MediaWiki 1.5 the contents of the old table and of the  table were merged together and moved to the  table and the  table. Finally the old table was renamed to  table. That way the text table also contains some old columns, which were part of the old table, but are now no longer needed in the text table.

After running the updater when updating from MediaWiki 1.4 or older to a newer version, all fields in the text table except old_id, old_text and old_flags are not needed anymore and can be safely deleted.

old_text contents may be compressed, as indicated by "gzip" in the old_flags field. (Data is compressed with the gzdeflate function of PHP: there is no gzip header or checksum, set the window size to negative(?) if not using PHP to read data.)

old_id serves as a unique index for a given revision, with some caveats:


 * Since the cur table carried the most recent revision separately, old_id was not assigned to a revision until it was no longer the most recent version of a page
 * Since the table does not preserve the old_id number, it will be different after deletion/restoration (the old number is not reused). The revision number (rev_id) however will be used so that links pointing to a specifix revision will still work after deletion/restoration.
 * old_id is not necessarily numerically chronological, either within a given page's history or in the whole database

old_timestamp also may not be unique in a page history series.

Schema summary
mysql> DESCRIBE old; +---+-+--+-+-++ +---+-+--+-+-++ +---+-+--+-+-++
 * Field            | Type                | Null | Key | Default | Extra          |
 * old_id           | int(8) unsigned     |      | PRI | NULL    | auto_increment |
 * old_namespace    | tinyint(2) unsigned |      |     | 0       |                |
 * old_title        | varchar(255) binary |      |     |         |                |
 * old_text         | mediumtext          |      |     |         |                |
 * old_comment      | tinyblob            |      |     |         |                |
 * old_user         | int(5) unsigned     |      |     | 0       |                |
 * old_user_text    | varchar(255) binary |      |     |         |                |
 * old_timestamp    | varchar(14) binary  |      |     |         |                |
 * old_minor_edit   | tinyint(1)          |      |     | 0       |                |
 * old_flags        | tinyblob            |      |     |         |                |
 * inverse_timestamp | varchar(14) binary |      |     |         |                |

Indexes
 +---++--+--+---+---+-+--++--++-+---+ +---++--+--+---+---+-+--++--++-+---+ +---++--+--+---+---+-+--++--++-+---+
 * Table | Non_unique | Key_name            | Seq_in_index | Column_name       | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
 * old  |          0 | PRIMARY              |            1 | old_id            | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
 * old  |          1 | old_timestamp        |            1 | old_timestamp     | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
 * old  |          1 | name_title_timestamp |            1 | old_namespace     | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
 * old  |          1 | name_title_timestamp |            2 | old_title         | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
 * old  |          1 | name_title_timestamp |            3 | inverse_timestamp | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
 * old  |          1 | user_timestamp       |            1 | old_user          | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
 * old  |          1 | user_timestamp       |            2 | inverse_timestamp | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
 * old  |          1 | usertext_timestamp   |            1 | old_user_text     | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
 * old  |          1 | usertext_timestamp   |            2 | inverse_timestamp | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |