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 @@ |
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
| 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 | + |
267 | 289 | function do_watchlist_update() { |
268 | 290 | global $wgDatabase; |
269 | 291 | $fname = 'do_watchlist_update'; |
— | — | @@ -1008,6 +1030,10 @@ |
1009 | 1031 | do_restrictions_update(); flush (); |
1010 | 1032 | |
1011 | 1033 | do_archive_user_index(); flush (); |
| 1034 | + |
| 1035 | + do_image_user_index(); flush (); |
| 1036 | + |
| 1037 | + do_oldimage_user_index(); flush (); |
1012 | 1038 | |
1013 | 1039 | echo "Deleting old default messages (this may take a long time!)..."; flush(); |
1014 | 1040 | deleteDefaultMessages(); |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -687,9 +687,9 @@ |
688 | 688 | |
689 | 689 | PRIMARY KEY img_name (img_name), |
690 | 690 | |
| 691 | + INDEX img_usertext_timestamp (img_user_text,img_timestamp), |
691 | 692 | -- Used by Special:Imagelist for sort-by-size |
692 | 693 | INDEX img_size (img_size), |
693 | | - |
694 | 694 | -- Used by Special:Newimages and Special:Imagelist |
695 | 695 | INDEX img_timestamp (img_timestamp) |
696 | 696 | |
— | — | @@ -724,6 +724,7 @@ |
725 | 725 | oi_minor_mime varbinary(32) NOT NULL default "unknown", |
726 | 726 | oi_deleted tinyint unsigned NOT NULL default '0', |
727 | 727 | |
| 728 | + INDEX oi_usertext_timestamp (oi_user_text,oi_timestamp), |
728 | 729 | INDEX oi_name_timestamp (oi_name,oi_timestamp), |
729 | 730 | -- oi_archive_name truncated to 14 to avoid key length overflow |
730 | 731 | INDEX oi_name_archive_name (oi_name,oi_archive_name(14)) |