add timestamp key on logging table, in order to avoid stupid filesorting
authorDomas Mituzas <midom@users.mediawiki.org>
Sat, 12 Nov 2005 20:25:33 +0000 (20:25 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Sat, 12 Nov 2005 20:25:33 +0000 (20:25 +0000)
maintenance/archives/patch-logging-times-index.sql [new file with mode: 0644]
maintenance/tables.sql
maintenance/updaters.inc

diff --git a/maintenance/archives/patch-logging-times-index.sql b/maintenance/archives/patch-logging-times-index.sql
new file mode 100644 (file)
index 0000000..e66ceec
--- /dev/null
@@ -0,0 +1,9 @@
+-- 
+-- patch-logging-times-index.sql
+-- 
+-- Add a very humble index on logging times
+-- 
+
+ALTER TABLE /*$wgDBprefix*/logging
+   ADD INDEX times (log_timestamp);
+
index db8f42b..018e7eb 100644 (file)
@@ -819,7 +819,8 @@ CREATE TABLE /*$wgDBprefix*/logging (
 
   KEY type_time (log_type, log_timestamp),
   KEY user_time (log_user, log_timestamp),
-  KEY page_time (log_namespace, log_title, log_timestamp)
+  KEY page_time (log_namespace, log_title, log_timestamp),
+  KEY times (log_timestamp)
 
 ) TYPE=InnoDB;
 
index ace5b2f..baadae3 100644 (file)
@@ -182,6 +182,18 @@ function do_image_name_unique_update() {
        }
 }
 
+function do_logging_timestamp_index() {
+       global $wgDatabase;
+       if( $wgDatabase->indexExists( 'logging', 'times' ) ) {
+               echo "...timestamp key on logging already exists.\n";
+       } else {
+               echo "Adding timestamp key on logging table... ";
+               dbsource( archive("patch-logging-times-index.sql"), $wgDatabase );
+               echo "ok\n";
+       }
+}
+
+
 function do_watchlist_update() {
        global $wgDatabase;
        if( $wgDatabase->fieldExists( 'watchlist', 'wl_notificationtimestamp' ) ) {
@@ -705,6 +717,8 @@ function do_all_updates() {
 
        //do_image_index_update(); flush();
 
+       do_logging_timestamp_index(); flush();
+
        initialiseMessages(); flush();
 }