Proposed Database Schema Changes/November 2006

From mediawiki.org

redirectlinks table (complete)[edit]

  • Bug 7304 - Multiple rows created in pagelinks tbl for a redirect page.

This feature is needed to solve an existing bug.

To allow langlinks table to be used just for regular links, and keep redirects separate and unique per page, we should create a new table with the layout identical to pagelinks, but different indexes. (Suggested by Brion in the bug report)

This patch to create this table has been added to the wiki. LinksUpdate.php needs to be modified before it gets applied.

 CREATE TABLE redirect (
  rd_from int(8) unsigned NOT NULL default '0',
  rd_namespace int NOT NULL default '0',
  rd_title varchar(255) binary NOT NULL default '',
 
  PRIMARY KEY rd_from (rd_from),
  KEY rd_ns_title (rd_namespace,rd_title,rd_from)
 ) TYPE=InnoDB;

Two-link QueryCache table (complete)[edit]

  • Bug 7311 - Create a two-link QueryCache table

There is a need for some special pages to cache two links per line instead of one. Examples include Special:Disambiguations, Special:BrokenRedirects, Special:DoubleRedirects, and possibly any other that are currently not implemented because of the caching limitations. The table structure will be identical to querycache table, except that it will have two additional fields (namespace2 & title2), plus it might have a number of additional indexes to facilitate better sorting.

 CREATE TABLE  `querycache2` (
  `qc2_type` char(32) NOT NULL,
  `qc2_value` int(5) unsigned NOT NULL default '0',
  `qc2_namespace` int(11) NOT NULL default '0',
  `qc2_title` char(255) character set latin1 collate latin1_bin NOT NULL default '',
  `qc2_namespace2` int(11) NOT NULL default '0',
  `qc2_title2` char(255) character set latin1 collate latin1_bin NOT NULL default '',
  KEY `qc2_value` (`qc2_type`,`qc2_value`),
  KEY `qc2_title` (`qc2_type`,`qc2_namespace`,`qc2_title`),
  KEY `qc2_title2` (`qc2_type`,`qc2_namespace2`,`qc2_title2`)
 )