bug 10280: For table categorylinks, add cl_from to the cl_sortkey index
authorYuri Astrakhan <yurik@users.mediawiki.org>
Fri, 15 Jun 2007 18:37:38 +0000 (18:37 +0000)
committerYuri Astrakhan <yurik@users.mediawiki.org>
Fri, 15 Jun 2007 18:37:38 +0000 (18:37 +0000)
maintenance/archives/patch-categorylinksindex.sql [new file with mode: 0644]
maintenance/updaters.inc

diff --git a/maintenance/archives/patch-categorylinksindex.sql b/maintenance/archives/patch-categorylinksindex.sql
new file mode 100644 (file)
index 0000000..8a9ff12
--- /dev/null
@@ -0,0 +1,11 @@
+-- 
+-- patch-categorylinksindex.sql
+-- 
+-- Per bug 10280 / http://bugzilla.wikimedia.org/show_bug.cgi?id=10280
+--
+-- Improve enum continuation performance of the what pages belong to a category query
+-- 
+
+ALTER TABLE /*$wgDBprefix*/categorylinks
+   DROP INDEX cl_sortkey,
+   ADD INDEX cl_sortkey(cl_to, cl_sortkey, cl_from);
index c2a69c9..6603861 100644 (file)
@@ -837,6 +837,14 @@ function do_backlinking_indices_update() {
        }
 }
 
+function do_categorylinks_indices_update() {
+       echo( "Checking for categorylinks indices...\n" );
+       if (!index_has_field('categorylinks', 'cl_sortkey', 'cl_from'))
+       {       
+               dbsource( archive( 'patch-categorylinksindex.sql' ) );
+       }
+}
+
 function do_stats_init() {
        // Sometimes site_stats table is not properly populated.
        global $wgDatabase;
@@ -932,6 +940,8 @@ function do_all_updates( $shared = false, $purge = true ) {
 
        do_backlinking_indices_update(); flush();
 
+       do_categorylinks_indices_update(); flush();
+
        do_restrictions_update(); flush ();
 
        echo "Deleting old default messages (this may take a long time!)..."; flush();