Manual:Old table

<- MediaWiki architecture < Database layout

The old table is where MediaWiki stores historical versions of articles. Most fields correspond to the same fields in cur.

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 carries the most recent revision separately, there is no unique ID for it until another revision is saved over it
 * Since the archive table does not preserve the id number, it will be different after deletion/restoration (but the old number is not reused)
 * 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.

"DESCRIBE old" gives the following:

+---+-+--+-+-++ +---+-+--+-+-++ +---+-+--+-+-++
 * 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 |      |     |         |                |