wiki.techinc.nl/maintenance/archives/patch-linktables.sql
Brion Vibber 59c6e92429 Some changes to the link tables. They now all use a key on cur_id for the *_from column instead of strings, and have a unique index to force prevent any duplicate entries. There's not yet a clean step in the update script, so just clear out your links tables (patch-linktables.sql) and rebuild them with refreshLinks.php.
This saves trouble in a number of places where we can now do joins with the link tables to get other info (such as cur_is_redirect!) as well as the name, and fewer bits need to be juggled on page renaming, as outgoing links no longer have to be changed (cur_id remains the same when a page is renamed).

rebuildLinks.inc and some of the tools in the 'maintenance page' still need to be updated to work with the new setup. (Special:Maintenance needs a *lot* of cleanup in general. It's kind of a catch-all of vaguely defined features which suck performance like a hydroelectric dam.)

Also I've slipped in some extra debug code. And, I think 'indexes.sql' is a big waste of time and should all be moved into tables.sql. Building indexes separately doesn't help on InnoDB and won't do anything on MyISAM either if you're just going to replace the table after it's built with an imported one from a dump which creates it with indexes.
2004-03-11 09:06:13 +00:00

48 lines
1.2 KiB
SQL

--
-- Track links that do exist
-- l_from and l_to key to cur_id
--
DROP TABLE IF EXISTS links;
CREATE TABLE links (
l_from int(8) unsigned NOT NULL default '0',
l_to int(8) unsigned NOT NULL default '0',
UNIQUE KEY l_from(l_from,l_to),
KEY (l_to)
);
--
-- Track links to pages that don't yet exist.
-- bl_from keys to cur_id
-- bl_to is a text link (namespace:title)
--
DROP TABLE IF EXISTS brokenlinks;
CREATE TABLE brokenlinks (
bl_from int(8) unsigned NOT NULL default '0',
bl_to varchar(255) binary NOT NULL default '',
UNIQUE KEY bl_from(bl_from,bl_to),
KEY (bl_to)
);
--
-- Track links to images *used inline*
-- il_from keys to cur_id, il_to keys to image_name.
-- We don't distinguish live from broken links.
--
DROP TABLE IF EXISTS imagelinks;
CREATE TABLE imagelinks (
il_from int(8) unsigned NOT NULL default '0',
il_to varchar(255) binary NOT NULL default '',
UNIQUE KEY il_from(il_from,il_to),
KEY (il_to)
);
--
-- Stores (possibly gzipped) serialized objects with
-- cache arrays to reduce database load slurping up
-- from links and brokenlinks.
--
DROP TABLE IF EXISTS linkscc;
CREATE TABLE linkscc (
lcc_pageid INT UNSIGNED NOT NULL UNIQUE KEY,
lcc_cacheobj MEDIUMBLOB NOT NULL
);