summaryrefslogtreecommitdiff
path: root/maintenance/archives/patch-mimesearch-indexes.sql
blob: bd348c46c26c99415638bdad440d2a5fb28d4c13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- Add indexes to the mime types in image for use on Special:MIMEsearch,
-- changes a query like
--
-- SELECT img_name FROM image WHERE img_major_mime = "image" AND img_minor_mime = "svg";
-- from:
-- +-------+------+---------------+------+---------+------+------+-------------+
-- | table | type | possible_keys | key  | key_len | ref  | rows | Extra       |
-- +-------+------+---------------+------+---------+------+------+-------------+
-- | image | ALL  | NULL          | NULL |    NULL | NULL |  194 | Using where |
-- +-------+------+---------------+------+---------+------+------+-------------+
-- to:
-- +-------+------+-------------------------------+----------------+---------+-------+------+-------------+
-- | table | type | possible_keys                 | key            | key_len | ref   | rows | Extra       |
-- +-------+------+-------------------------------+----------------+---------+-------+------+-------------+
-- | image | ref  | img_major_mime,img_minor_mime | img_minor_mime |      32 | const |    4 | Using where |
-- +-------+------+-------------------------------+----------------+---------+-------+------+-------------+

ALTER TABLE /*$wgDBprefix*/image
	ADD INDEX img_major_mime (img_major_mime);
ALTER TABLE /*$wgDBprefix*/image
	ADD INDEX img_minor_mime (img_minor_mime);