(bug 13438) Make Special:MIMESearch less expensive. Needs some benchmarking to see...
authorChad Horohoe <demon@users.mediawiki.org>
Thu, 26 Jun 2008 20:38:26 +0000 (20:38 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Thu, 26 Jun 2008 20:38:26 +0000 (20:38 +0000)
maintenance/archives/patch-index-img_mime.sql [new file with mode: 0644]
maintenance/tables.sql
maintenance/updaters.inc

diff --git a/maintenance/archives/patch-index-img_mime.sql b/maintenance/archives/patch-index-img_mime.sql
new file mode 100644 (file)
index 0000000..f808e1a
--- /dev/null
@@ -0,0 +1,6 @@
+-- Indexing MIME types
+--
+-- Allows MIME search to work on large databases like Wikimedia one
+
+ALTER TABLE /*$wgDBprefix*/image
+   ADD INDEX img_mime (img_major_mime, img_minor_mime);
index 5b83983..d717dcc 100644 (file)
@@ -745,9 +745,11 @@ CREATE TABLE /*$wgDBprefix*/image (
   INDEX img_size (img_size),
   -- Used by Special:Newimages and Special:Imagelist
   INDEX img_timestamp (img_timestamp),
+  -- Used in API and duplicate search
+  INDEX img_sha1 (img_sha1),
+  -- Used in MIME search
+  INDEX img_mime (img_major_mime, img_minor_mime)
 
-  -- For future use
-  INDEX img_sha1 (img_sha1)
 
 
 ) /*$wgDBTableOptions*/;
index c83893b..8f5ffbb 100644 (file)
@@ -143,6 +143,7 @@ $wgMysqlUpdates = array(
        array( 'maybe_do_profiling_memory_update' ),
        array( 'do_filearchive_indices_update' ),
        array( 'update_password_format' ),
+       array( 'add_index', 'image',      'img_mime',      'patch-index-img_mime.sql' ),
 );