r45821 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45820‎ | r45821 | r45822 >
Date:23:15, 16 January 2009
Author:catrope
Status:reverted
Tags:
Comment:
(bug 16645) Making the pl_namespace, tl_namespace and il_to indices UNIQUE, just like their differently-ordered counterparts. This helps MySQL optimize stuff (see bug)
Modified paths:
  • /trunk/phase3/maintenance/archives/patch-pl-tl-il-unique.sql (added) (history)
  • /trunk/phase3/maintenance/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/archives/patch-pl-tl-il-unique.sql
@@ -0,0 +1,11 @@
 2+--
 3+-- patch-pl-tl-il-unique-index.sql
 4+--
 5+-- Make reorderings of UNIQUE indices UNIQUE as well
 6+
 7+DROP INDEX pl_namespace ON /*_*/pagelinks;
 8+CREATE UNIQUE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace, pl_title, pl_from);
 9+DROP INDEX tl_namespace ON /*_*/templatelinks;
 10+CREATE UNIQUE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace, tl_title, tl_from);
 11+DROP INDEX il_to ON /*_*/imagelinks;
 12+CREATE UNIQUE INDEX il_to ON /*_*/imagelinks (il_to, il_from);
Index: trunk/phase3/maintenance/updaters.inc
@@ -150,6 +150,7 @@
151151 array( 'do_active_users_init' ),
152152 array( 'add_field', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
153153 array( 'add_index', 'user_newtalk', 'un_user_id', 'patch-index-renames.sql' ),
 154+ array( 'do_unique_pl_tl_il' ),
154155 ),
155156
156157 'sqlite' => array(
@@ -1266,6 +1267,17 @@
12671268 echo "done\n";
12681269 }
12691270
 1271+function do_unique_pl_tl_il() {
 1272+ global $wgDatabase;
 1273+ $info = $wgDatabase->indexInfo( 'pagelinks', 'pl_namespace' );
 1274+ if( !$info->Non_unique ) {
 1275+ echo "...pl_namespace, tl_namespace, il_to indices are already UNIQUE.\n";
 1276+ } else {
 1277+ echo "Making pl_namespace, tl_namespace and il_to indices UNIQUE... ";
 1278+ dbsource( archive( 'patch-pl-tl-il-unique.sql' ), $wgDatabase );
 1279+ echo "ok\n";
 1280+ }
 1281+}
12701282
12711283 /***********************************************************************
12721284 * Start PG crap
Index: trunk/phase3/maintenance/tables.sql
@@ -408,7 +408,7 @@
409409 ) /*$wgDBTableOptions*/;
410410
411411 CREATE UNIQUE INDEX pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title);
412 -CREATE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from);
 412+CREATE UNIQUE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from);
413413
414414
415415 --
@@ -427,7 +427,7 @@
428428 ) /*$wgDBTableOptions*/;
429429
430430 CREATE UNIQUE INDEX tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title);
431 -CREATE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from);
 431+CREATE UNIQUE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from);
432432
433433
434434 --
@@ -446,7 +446,7 @@
447447 ) /*$wgDBTableOptions*/;
448448
449449 CREATE UNIQUE INDEX il_from ON /*_*/imagelinks (il_from,il_to);
450 -CREATE INDEX il_to ON /*_*/imagelinks (il_to,il_from);
 450+CREATE UNIQUE INDEX il_to ON /*_*/imagelinks (il_to,il_from);
451451
452452
453453 --

Follow-up revisions

RevisionCommit summaryAuthorDate
r45891Revert r45821, r45830, r45831 and r45835 all in order to revert r45819, per d...catrope13:56, 19 January 2009
r45897Recommit r45821: (bug 16645) Making the pl_namespace, tl_namespace and il_to ...catrope15:33, 19 January 2009

Status & tagging log