r23916 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23915‎ | r23916 | r23917 >
Date:19:39, 9 July 2007
Author:aaron
Status:old
Tags:
Comment:
*Index image and oldimage tables by user/timestamp (this should help slow renameuser queries on commons at the least)
Modified paths:
  • /trunk/phase3/maintenance/archives/patch-image-user-index.sql (added) (history)
  • /trunk/phase3/maintenance/archives/patch-oldimage-user-index.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-oldimage-user-index.sql
@@ -0,0 +1,8 @@
 2+--
 3+-- oldimage-user-index.sql
 4+--
 5+-- Add user/timestamp index to old image versions
 6+--
 7+
 8+ALTER TABLE /*$wgDBprefix*/oldimage
 9+ ADD INDEX oi_usertext_timestamp (oi_user_text,oi_timestamp);
Index: trunk/phase3/maintenance/archives/patch-image-user-index.sql
@@ -0,0 +1,8 @@
 2+--
 3+-- image-user-index.sql
 4+--
 5+-- Add user/timestamp index to current image versions
 6+--
 7+
 8+ALTER TABLE /*$wgDBprefix*/image
 9+ ADD INDEX img_usertext_timestamp (img_user_text,img_timestamp);
Index: trunk/phase3/maintenance/updaters.inc
@@ -263,6 +263,28 @@
264264 }
265265 }
266266
 267+function do_image_user_index() {
 268+ global $wgDatabase;
 269+ if( $wgDatabase->indexExists( 'image', 'img_usertext_timestamp' ) ) {
 270+ echo "...usertext,timestamp key on image already exists.\n";
 271+ } else {
 272+ echo "Adding usertext,timestamp key on image table... ";
 273+ dbsource( archive("patch-image-user-index.sql"), $wgDatabase );
 274+ echo "ok\n";
 275+ }
 276+}
 277+
 278+function do_oldimage_user_index() {
 279+ global $wgDatabase;
 280+ if( $wgDatabase->indexExists( 'oldimage', 'oi_usertext_timestamp' ) ) {
 281+ echo "...usertext,timestamp key on oldimage already exists.\n";
 282+ } else {
 283+ echo "Adding usertext,timestamp key on oldimage table... ";
 284+ dbsource( archive("patch-oldimage-user-index.sql"), $wgDatabase );
 285+ echo "ok\n";
 286+ }
 287+}
 288+
267289 function do_watchlist_update() {
268290 global $wgDatabase;
269291 $fname = 'do_watchlist_update';
@@ -1008,6 +1030,10 @@
10091031 do_restrictions_update(); flush ();
10101032
10111033 do_archive_user_index(); flush ();
 1034+
 1035+ do_image_user_index(); flush ();
 1036+
 1037+ do_oldimage_user_index(); flush ();
10121038
10131039 echo "Deleting old default messages (this may take a long time!)..."; flush();
10141040 deleteDefaultMessages();
Index: trunk/phase3/maintenance/tables.sql
@@ -687,9 +687,9 @@
688688
689689 PRIMARY KEY img_name (img_name),
690690
 691+ INDEX img_usertext_timestamp (img_user_text,img_timestamp),
691692 -- Used by Special:Imagelist for sort-by-size
692693 INDEX img_size (img_size),
693 -
694694 -- Used by Special:Newimages and Special:Imagelist
695695 INDEX img_timestamp (img_timestamp)
696696
@@ -724,6 +724,7 @@
725725 oi_minor_mime varbinary(32) NOT NULL default "unknown",
726726 oi_deleted tinyint unsigned NOT NULL default '0',
727727
 728+ INDEX oi_usertext_timestamp (oi_user_text,oi_timestamp),
728729 INDEX oi_name_timestamp (oi_name,oi_timestamp),
729730 -- oi_archive_name truncated to 14 to avoid key length overflow
730731 INDEX oi_name_archive_name (oi_name,oi_archive_name(14))

Follow-up revisions

RevisionCommit summaryAuthorDate
r24096Merged revisions 23910-24094 via svnmerge from...david22:38, 14 July 2007

Status & tagging log