r45897 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45896‎ | r45897 | r45898 >
Date:15:33, 19 January 2009
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
Recommit r45821: (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 /*i*/pl_namespace ON /*_*/pagelinks;
 8+CREATE UNIQUE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace, pl_title, pl_from);
 9+DROP INDEX /*i*/tl_namespace ON /*_*/templatelinks;
 10+CREATE UNIQUE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace, tl_title, tl_from);
 11+DROP INDEX /*i*/il_to ON /*_*/imagelinks;
 12+CREATE UNIQUE INDEX /*i*/il_to ON /*_*/imagelinks (il_to, il_from);
Property changes on: trunk/phase3/maintenance/archives/patch-pl-tl-il-unique.sql
___________________________________________________________________
Name: svn:eol-style
113 + native
Index: trunk/phase3/maintenance/updaters.inc
@@ -149,6 +149,7 @@
150150 array( 'add_field', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),
151151 array( 'do_active_users_init' ),
152152 array( 'add_field', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
 153+ array( 'do_unique_pl_tl_il' ),
153154 ),
154155
155156 'sqlite' => array(
@@ -1265,6 +1266,17 @@
12661267 echo "done\n";
12671268 }
12681269
 1270+function do_unique_pl_tl_il() {
 1271+ global $wgDatabase;
 1272+ $info = $wgDatabase->indexInfo( 'pagelinks', 'pl_namespace' );
 1273+ if( !$info->Non_unique ) {
 1274+ echo "...pl_namespace, tl_namespace, il_to indices are already UNIQUE.\n";
 1275+ } else {
 1276+ echo "Making pl_namespace, tl_namespace and il_to indices UNIQUE... ";
 1277+ dbsource( archive( 'patch-pl-tl-il-unique.sql' ), $wgDatabase );
 1278+ echo "ok\n";
 1279+ }
 1280+}
12691281
12701282 /***********************************************************************
12711283 * Start PG crap
Index: trunk/phase3/maintenance/tables.sql
@@ -408,7 +408,7 @@
409409 ) /*$wgDBTableOptions*/;
410410
411411 CREATE UNIQUE INDEX /*i*/pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title);
412 -CREATE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from);
 412+CREATE UNIQUE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from);
413413
414414
415415 --
@@ -427,7 +427,7 @@
428428 ) /*$wgDBTableOptions*/;
429429
430430 CREATE UNIQUE INDEX /*i*/tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title);
431 -CREATE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from);
 431+CREATE UNIQUE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from);
432432
433433
434434 --
@@ -446,7 +446,7 @@
447447 ) /*$wgDBTableOptions*/;
448448
449449 CREATE UNIQUE INDEX /*i*/il_from ON /*_*/imagelinks (il_from,il_to);
450 -CREATE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from);
 450+CREATE UNIQUE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from);
451451
452452
453453 --

Follow-up revisions

RevisionCommit summaryAuthorDate
r45921Fix up r45897: indexInfo() returns an array of objects rather than an objectcatrope13:13, 20 January 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r45821(bug 16645) Making the pl_namespace, tl_namespace and il_to indices UNIQUE, j...catrope23:15, 16 January 2009

Comments

#Comment by Siebrand (talk | contribs)   21:00, 19 January 2009

PHP Notice: Trying to get property of non-object in /var/www/w/maintenance/updaters.inc on line 1272

#Comment by Catrope (talk | contribs)   13:14, 20 January 2009

Fixed in r45921

#Comment by Simetrical (talk | contribs)   00:32, 29 January 2009

This is an *enormous* alter table for such questionable benefit . . .

Status & tagging log