1 -- Correct for the total lack of indexes in the MW 1.13 SQLite schema
3 -- Unique indexes need to be handled with INSERT SELECT since just running
4 -- the CREATE INDEX statement will fail if there are duplicate values.
6 -- Ignore duplicates, several tables will have them (e.g. T18966) but in
7 -- most cases it's harmless to discard them.
9 --------------------------------------------------------------------------------
10 -- Drop temporary tables from aborted runs
11 --------------------------------------------------------------------------------
13 DROP TABLE IF EXISTS /*_*/user_tmp;
14 DROP TABLE IF EXISTS /*_*/user_groups_tmp;
15 DROP TABLE IF EXISTS /*_*/page_tmp;
16 DROP TABLE IF EXISTS /*_*/revision_tmp;
17 DROP TABLE IF EXISTS /*_*/pagelinks_tmp;
18 DROP TABLE IF EXISTS /*_*/templatelinks_tmp;
19 DROP TABLE IF EXISTS /*_*/imagelinks_tmp;
20 DROP TABLE IF EXISTS /*_*/categorylinks_tmp;
21 DROP TABLE IF EXISTS /*_*/category_tmp;
22 DROP TABLE IF EXISTS /*_*/langlinks_tmp;
23 DROP TABLE IF EXISTS /*_*/site_stats_tmp;
24 DROP TABLE IF EXISTS /*_*/ipblocks_tmp;
25 DROP TABLE IF EXISTS /*_*/watchlist_tmp;
26 DROP TABLE IF EXISTS /*_*/math_tmp;
27 DROP TABLE IF EXISTS /*_*/interwiki_tmp;
28 DROP TABLE IF EXISTS /*_*/page_restrictions_tmp;
29 DROP TABLE IF EXISTS /*_*/protected_titles_tmp;
30 DROP TABLE IF EXISTS /*_*/page_props_tmp;
31 DROP TABLE IF EXISTS /*_*/archive_tmp;
32 DROP TABLE IF EXISTS /*_*/externallinks_tmp;
34 --------------------------------------------------------------------------------
36 --------------------------------------------------------------------------------
38 CREATE TABLE /*_*/user_tmp (
39 user_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
40 user_name varchar(255) binary NOT NULL default '',
41 user_real_name varchar(255) binary NOT NULL default '',
42 user_password tinyblob NOT NULL,
43 user_newpassword tinyblob NOT NULL,
44 user_newpass_time binary(14),
45 user_email tinytext NOT NULL,
46 user_options blob NOT NULL,
47 user_touched binary(14) NOT NULL default '',
48 user_token binary(32) NOT NULL default '',
49 user_email_authenticated binary(14),
50 user_email_token binary(32),
51 user_email_token_expires binary(14),
52 user_registration binary(14),
55 CREATE UNIQUE INDEX /*i*/user_name ON /*_*/user_tmp (user_name);
56 CREATE INDEX /*i*/user_email_token ON /*_*/user_tmp (user_email_token);
59 CREATE TABLE /*_*/user_groups_tmp (
60 ug_user int unsigned NOT NULL default 0,
61 ug_group varbinary(16) NOT NULL default ''
64 CREATE UNIQUE INDEX /*i*/ug_user_group ON /*_*/user_groups_tmp (ug_user,ug_group);
65 CREATE INDEX /*i*/ug_group ON /*_*/user_groups_tmp (ug_group);
67 CREATE TABLE /*_*/page_tmp (
68 page_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
69 page_namespace int NOT NULL,
70 page_title varchar(255) binary NOT NULL,
71 page_restrictions tinyblob NOT NULL,
72 page_is_redirect tinyint unsigned NOT NULL default 0,
73 page_is_new tinyint unsigned NOT NULL default 0,
74 page_random real unsigned NOT NULL,
75 page_touched binary(14) NOT NULL default '',
76 page_latest int unsigned NOT NULL,
77 page_len int unsigned NOT NULL
80 CREATE UNIQUE INDEX /*i*/name_title ON /*_*/page_tmp (page_namespace,page_title);
81 CREATE INDEX /*i*/page_random ON /*_*/page_tmp (page_random);
82 CREATE INDEX /*i*/page_len ON /*_*/page_tmp (page_len);
85 CREATE TABLE /*_*/revision_tmp (
86 rev_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
87 rev_page int unsigned NOT NULL,
88 rev_text_id int unsigned NOT NULL,
89 rev_comment tinyblob NOT NULL,
90 rev_user int unsigned NOT NULL default 0,
91 rev_user_text varchar(255) binary NOT NULL default '',
92 rev_timestamp binary(14) NOT NULL default '',
93 rev_minor_edit tinyint unsigned NOT NULL default 0,
94 rev_deleted tinyint unsigned NOT NULL default 0,
96 rev_parent_id int unsigned default NULL
98 CREATE UNIQUE INDEX /*i*/rev_page_id ON /*_*/revision_tmp (rev_page, rev_id);
99 CREATE INDEX /*i*/rev_timestamp ON /*_*/revision_tmp (rev_timestamp);
100 CREATE INDEX /*i*/page_timestamp ON /*_*/revision_tmp (rev_page,rev_timestamp);
101 CREATE INDEX /*i*/user_timestamp ON /*_*/revision_tmp (rev_user,rev_timestamp);
102 CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision_tmp (rev_user_text,rev_timestamp);
104 CREATE TABLE /*_*/pagelinks_tmp (
105 pl_from int unsigned NOT NULL default 0,
106 pl_namespace int NOT NULL default 0,
107 pl_title varchar(255) binary NOT NULL default ''
110 CREATE UNIQUE INDEX /*i*/pl_from ON /*_*/pagelinks_tmp (pl_from,pl_namespace,pl_title);
111 CREATE INDEX /*i*/pl_namespace_title ON /*_*/pagelinks_tmp (pl_namespace,pl_title,pl_from);
114 CREATE TABLE /*_*/templatelinks_tmp (
115 tl_from int unsigned NOT NULL default 0,
116 tl_namespace int NOT NULL default 0,
117 tl_title varchar(255) binary NOT NULL default ''
120 CREATE UNIQUE INDEX /*i*/tl_from ON /*_*/templatelinks_tmp (tl_from,tl_namespace,tl_title);
121 CREATE INDEX /*i*/tl_namespace_title ON /*_*/templatelinks_tmp (tl_namespace,tl_title,tl_from);
124 CREATE TABLE /*_*/imagelinks_tmp (
125 il_from int unsigned NOT NULL default 0,
126 il_to varchar(255) binary NOT NULL default ''
127 ) /*$wgDBTableOptions*/;
128 CREATE UNIQUE INDEX /*i*/il_from ON /*_*/imagelinks_tmp (il_from,il_to);
129 CREATE INDEX /*i*/il_to ON /*_*/imagelinks_tmp (il_to,il_from);
132 CREATE TABLE /*_*/categorylinks_tmp (
133 cl_from int unsigned NOT NULL default 0,
134 cl_to varchar(255) binary NOT NULL default '',
135 cl_sortkey varchar(70) binary NOT NULL default '',
136 cl_timestamp timestamp NOT NULL
138 CREATE UNIQUE INDEX /*i*/cl_from ON /*_*/categorylinks_tmp (cl_from,cl_to);
139 CREATE INDEX /*i*/cl_sortkey ON /*_*/categorylinks_tmp (cl_to,cl_sortkey,cl_from);
140 CREATE INDEX /*i*/cl_timestamp ON /*_*/categorylinks_tmp (cl_to,cl_timestamp);
143 CREATE TABLE /*_*/category_tmp (
144 cat_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
145 cat_title varchar(255) binary NOT NULL,
146 cat_pages int signed NOT NULL default 0,
147 cat_subcats int signed NOT NULL default 0,
148 cat_files int signed NOT NULL default 0,
149 cat_hidden tinyint unsigned NOT NULL default 0
151 CREATE UNIQUE INDEX /*i*/cat_title ON /*_*/category_tmp (cat_title);
152 CREATE INDEX /*i*/cat_pages ON /*_*/category_tmp (cat_pages);
154 CREATE TABLE /*_*/langlinks_tmp (
155 ll_from int unsigned NOT NULL default 0,
156 ll_lang varbinary(20) NOT NULL default '',
157 ll_title varchar(255) binary NOT NULL default ''
160 CREATE UNIQUE INDEX /*i*/ll_from ON /*_*/langlinks_tmp (ll_from, ll_lang);
161 CREATE INDEX /*i*/ll_lang_title ON /*_*/langlinks_tmp (ll_lang, ll_title);
164 CREATE TABLE /*_*/site_stats_tmp (
165 ss_row_id int unsigned NOT NULL,
166 ss_total_edits bigint unsigned default 0,
167 ss_good_articles bigint unsigned default 0,
168 ss_total_pages bigint default '-1',
169 ss_users bigint default '-1',
170 ss_active_users bigint default '-1',
171 ss_admins int default '-1',
172 ss_images int default 0
174 CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats_tmp (ss_row_id);
177 CREATE TABLE /*_*/ipblocks_tmp (
178 ipb_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
179 ipb_address tinyblob NOT NULL,
180 ipb_user int unsigned NOT NULL default 0,
181 ipb_by int unsigned NOT NULL default 0,
182 ipb_by_text varchar(255) binary NOT NULL default '',
183 ipb_reason tinyblob NOT NULL,
184 ipb_timestamp binary(14) NOT NULL default '',
185 ipb_auto bool NOT NULL default 0,
187 -- If set to 1, block applies only to logged-out users
188 ipb_anon_only bool NOT NULL default 0,
189 ipb_create_account bool NOT NULL default 1,
190 ipb_enable_autoblock bool NOT NULL default '1',
191 ipb_expiry varbinary(14) NOT NULL default '',
192 ipb_range_start tinyblob NOT NULL,
193 ipb_range_end tinyblob NOT NULL,
194 ipb_deleted bool NOT NULL default 0,
195 ipb_block_email bool NOT NULL default 0,
196 ipb_allow_usertalk bool NOT NULL default 0
198 CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks_tmp (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only);
199 CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks_tmp (ipb_user);
200 CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks_tmp (ipb_range_start(8), ipb_range_end(8));
201 CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks_tmp (ipb_timestamp);
202 CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks_tmp (ipb_expiry);
205 CREATE TABLE /*_*/watchlist_tmp (
206 wl_user int unsigned NOT NULL,
207 wl_namespace int NOT NULL default 0,
208 wl_title varchar(255) binary NOT NULL default '',
209 wl_notificationtimestamp varbinary(14)
212 CREATE UNIQUE INDEX /*i*/wl_user_namespace_title ON /*_*/watchlist_tmp (wl_user, wl_namespace, wl_title);
213 CREATE INDEX /*i*/namespace_title ON /*_*/watchlist_tmp (wl_namespace, wl_title);
216 CREATE TABLE /*_*/math_tmp (
217 math_inputhash varbinary(16) NOT NULL,
218 math_outputhash varbinary(16) NOT NULL,
219 math_html_conservativeness tinyint NOT NULL,
224 CREATE UNIQUE INDEX /*i*/math_inputhash ON /*_*/math_tmp (math_inputhash);
227 CREATE TABLE /*_*/interwiki_tmp (
228 iw_prefix varchar(32) NOT NULL,
229 iw_url blob NOT NULL,
230 iw_local bool NOT NULL,
231 iw_trans tinyint NOT NULL default 0
234 CREATE UNIQUE INDEX /*i*/iw_prefix ON /*_*/interwiki_tmp (iw_prefix);
237 CREATE TABLE /*_*/page_restrictions_tmp (
238 pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
239 pr_page int NOT NULL,
240 pr_type varbinary(60) NOT NULL,
241 pr_level varbinary(60) NOT NULL,
242 pr_cascade tinyint NOT NULL,
244 pr_expiry varbinary(14) NULL
247 CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions_tmp (pr_page,pr_type);
248 CREATE UNIQUE INDEX /*i*/pr_typelevel ON /*_*/page_restrictions_tmp (pr_type,pr_level);
249 CREATE UNIQUE INDEX /*i*/pr_level ON /*_*/page_restrictions_tmp (pr_level);
250 CREATE UNIQUE INDEX /*i*/pr_cascade ON /*_*/page_restrictions_tmp (pr_cascade);
252 CREATE TABLE /*_*/protected_titles_tmp (
253 pt_namespace int NOT NULL,
254 pt_title varchar(255) binary NOT NULL,
255 pt_user int unsigned NOT NULL,
257 pt_timestamp binary(14) NOT NULL,
258 pt_expiry varbinary(14) NOT NULL default '',
259 pt_create_perm varbinary(60) NOT NULL
261 CREATE UNIQUE INDEX /*i*/pt_namespace_title ON /*_*/protected_titles_tmp (pt_namespace,pt_title);
262 CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles_tmp (pt_timestamp);
264 CREATE TABLE /*_*/page_props_tmp (
265 pp_page int NOT NULL,
266 pp_propname varbinary(60) NOT NULL,
267 pp_value blob NOT NULL
269 CREATE UNIQUE INDEX /*i*/pp_page_propname ON /*_*/page_props_tmp (pp_page,pp_propname);
272 -- Holding area for deleted articles, which may be viewed
273 -- or restored by admins through the Special:Undelete interface.
274 -- The fields generally correspond to the page, revision, and text
275 -- fields, with several caveats.
276 -- Cannot reasonably create views on this table, due to the presence of TEXT
278 CREATE TABLE /*$wgDBprefix*/archive_tmp (
279 ar_id NOT NULL PRIMARY KEY clustered IDENTITY,
280 ar_namespace SMALLINT NOT NULL DEFAULT 0,
281 ar_title NVARCHAR(255) NOT NULL DEFAULT '',
282 ar_text NVARCHAR(MAX) NOT NULL,
283 ar_comment NVARCHAR(255) NOT NULL,
284 ar_user INT NULL REFERENCES /*$wgDBprefix*/[user](user_id) ON DELETE SET NULL,
285 ar_user_text NVARCHAR(255) NOT NULL,
286 ar_timestamp DATETIME NOT NULL DEFAULT GETDATE(),
287 ar_minor_edit BIT NOT NULL DEFAULT 0,
288 ar_flags NVARCHAR(255) NOT NULL,
291 ar_deleted BIT NOT NULL DEFAULT 0,
292 ar_len INT DEFAULT NULL,
294 ar_parent_id INT NULL
296 CREATE INDEX /*$wgDBprefix*/ar_name_title_timestamp ON /*$wgDBprefix*/archive_tmp(ar_namespace,ar_title,ar_timestamp);
297 CREATE INDEX /*$wgDBprefix*/ar_usertext_timestamp ON /*$wgDBprefix*/archive_tmp(ar_user_text,ar_timestamp);
298 CREATE INDEX /*$wgDBprefix*/ar_user_text ON /*$wgDBprefix*/archive_tmp(ar_user_text);
301 -- Track links to external URLs
302 -- IE >= 4 supports no more than 2083 characters in a URL
303 CREATE TABLE /*$wgDBprefix*/externallinks_tmp (
304 el_id INT NOT NULL PRIMARY KEY clustered IDENTITY,
305 el_from INT NOT NULL DEFAULT '0',
306 el_to VARCHAR(2083) NOT NULL,
307 el_index VARCHAR(896) NOT NULL,
309 -- Maximum key length ON SQL Server is 900 bytes
310 CREATE INDEX /*$wgDBprefix*/externallinks_index ON /*$wgDBprefix*/externallinks_tmp(el_index);
312 --------------------------------------------------------------------------------
313 -- Populate the new tables using INSERT SELECT
314 --------------------------------------------------------------------------------
316 INSERT OR IGNORE INTO /*_*/user_tmp SELECT * FROM /*_*/user;
317 INSERT OR IGNORE INTO /*_*/user_groups_tmp SELECT * FROM /*_*/user_groups;
318 INSERT OR IGNORE INTO /*_*/page_tmp SELECT * FROM /*_*/page;
319 INSERT OR IGNORE INTO /*_*/revision_tmp SELECT * FROM /*_*/revision;
320 INSERT OR IGNORE INTO /*_*/pagelinks_tmp SELECT * FROM /*_*/pagelinks;
321 INSERT OR IGNORE INTO /*_*/templatelinks_tmp SELECT * FROM /*_*/templatelinks;
322 INSERT OR IGNORE INTO /*_*/imagelinks_tmp SELECT * FROM /*_*/imagelinks;
323 INSERT OR IGNORE INTO /*_*/categorylinks_tmp SELECT * FROM /*_*/categorylinks;
324 INSERT OR IGNORE INTO /*_*/category_tmp SELECT * FROM /*_*/category;
325 INSERT OR IGNORE INTO /*_*/langlinks_tmp SELECT * FROM /*_*/langlinks;
326 INSERT OR IGNORE INTO /*_*/site_stats_tmp SELECT * FROM /*_*/site_stats;
327 INSERT OR IGNORE INTO /*_*/ipblocks_tmp SELECT * FROM /*_*/ipblocks;
328 INSERT OR IGNORE INTO /*_*/watchlist_tmp SELECT * FROM /*_*/watchlist;
329 INSERT OR IGNORE INTO /*_*/math_tmp SELECT * FROM /*_*/math;
330 INSERT OR IGNORE INTO /*_*/interwiki_tmp SELECT * FROM /*_*/interwiki;
331 INSERT OR IGNORE INTO /*_*/page_restrictions_tmp SELECT * FROM /*_*/page_restrictions;
332 INSERT OR IGNORE INTO /*_*/protected_titles_tmp SELECT * FROM /*_*/protected_titles;
333 INSERT OR IGNORE INTO /*_*/page_props_tmp SELECT * FROM /*_*/page_props;
334 INSERT OR IGNORE INTO /*_*/archive_tmp SELECT * FROM /*_*/archive;
335 INSERT OR IGNORE INTO /*_*/externallinks_tmp SELECT * FROM /*_*/externallinks;
337 --------------------------------------------------------------------------------
338 -- Do the table renames
339 --------------------------------------------------------------------------------
341 DROP TABLE /*_*/user;
342 ALTER TABLE /*_*/user_tmp RENAME TO /*_*/user;
343 DROP TABLE /*_*/user_groups;
344 ALTER TABLE /*_*/user_groups_tmp RENAME TO /*_*/user_groups;
345 DROP TABLE /*_*/page;
346 ALTER TABLE /*_*/page_tmp RENAME TO /*_*/page;
347 DROP TABLE /*_*/revision;
348 ALTER TABLE /*_*/revision_tmp RENAME TO /*_*/revision;
349 DROP TABLE /*_*/pagelinks;
350 ALTER TABLE /*_*/pagelinks_tmp RENAME TO /*_*/pagelinks;
351 DROP TABLE /*_*/templatelinks;
352 ALTER TABLE /*_*/templatelinks_tmp RENAME TO /*_*/templatelinks;
353 DROP TABLE /*_*/imagelinks;
354 ALTER TABLE /*_*/imagelinks_tmp RENAME TO /*_*/imagelinks;
355 DROP TABLE /*_*/categorylinks;
356 ALTER TABLE /*_*/categorylinks_tmp RENAME TO /*_*/categorylinks;
357 DROP TABLE /*_*/category;
358 ALTER TABLE /*_*/category_tmp RENAME TO /*_*/category;
359 DROP TABLE /*_*/langlinks;
360 ALTER TABLE /*_*/langlinks_tmp RENAME TO /*_*/langlinks;
361 DROP TABLE /*_*/site_stats;
362 ALTER TABLE /*_*/site_stats_tmp RENAME TO /*_*/site_stats;
363 DROP TABLE /*_*/ipblocks;
364 ALTER TABLE /*_*/ipblocks_tmp RENAME TO /*_*/ipblocks;
365 DROP TABLE /*_*/watchlist;
366 ALTER TABLE /*_*/watchlist_tmp RENAME TO /*_*/watchlist;
367 DROP TABLE /*_*/math;
368 ALTER TABLE /*_*/math_tmp RENAME TO /*_*/math;
369 DROP TABLE /*_*/interwiki;
370 ALTER TABLE /*_*/interwiki_tmp RENAME TO /*_*/interwiki;
371 DROP TABLE /*_*/page_restrictions;
372 ALTER TABLE /*_*/page_restrictions_tmp RENAME TO /*_*/page_restrictions;
373 DROP TABLE /*_*/protected_titles;
374 ALTER TABLE /*_*/protected_titles_tmp RENAME TO /*_*/protected_titles;
375 DROP TABLE /*_*/page_props;
376 ALTER TABLE /*_*/page_props_tmp RENAME TO /*_*/page_props;
377 DROP TABLE /*_*/archive;
378 ALTER TABLE /*_*/archive_tmp RENAME TO /*_*/archive;
379 DROP TABLE /*_*/externalllinks;
380 ALTER TABLE /*_*/externallinks_tmp RENAME TO /*_*/externallinks;
382 --------------------------------------------------------------------------------
383 -- Drop and create tables with unique indexes but no valuable data
384 --------------------------------------------------------------------------------
387 DROP TABLE IF EXISTS /*_*/searchindex;
388 CREATE TABLE /*_*/searchindex (
389 si_page int unsigned NOT NULL,
390 si_title varchar(255) NOT NULL default '',
391 si_text mediumtext NOT NULL
393 CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex (si_page);
394 CREATE INDEX /*i*/si_title ON /*_*/searchindex (si_title);
395 CREATE INDEX /*i*/si_text ON /*_*/searchindex (si_text);
397 DROP TABLE IF EXISTS /*_*/transcache;
398 CREATE TABLE /*_*/transcache (
399 tc_url varbinary(255) NOT NULL,
402 ) /*$wgDBTableOptions*/;
403 CREATE UNIQUE INDEX /*i*/tc_url_idx ON /*_*/transcache (tc_url);
405 DROP TABLE IF EXISTS /*_*/querycache_info;
406 CREATE TABLE /*_*/querycache_info (
407 qci_type varbinary(32) NOT NULL default '',
408 qci_timestamp binary(14) NOT NULL default '19700101000000'
409 ) /*$wgDBTableOptions*/;
410 CREATE UNIQUE INDEX /*i*/qci_type ON /*_*/querycache_info (qci_type);
412 --------------------------------------------------------------------------------
413 -- Empty some cache tables to make the update faster
414 --------------------------------------------------------------------------------
416 DELETE FROM /*_*/querycache;
417 DELETE FROM /*_*/objectcache;
418 DELETE FROM /*_*/querycachetwo;
420 --------------------------------------------------------------------------------
421 -- Add indexes to tables with no unique indexes
422 --------------------------------------------------------------------------------
424 CREATE INDEX /*i*/un_user_id ON /*_*/user_newtalk (user_id);
425 CREATE INDEX /*i*/un_user_ip ON /*_*/user_newtalk (user_ip);
426 CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
427 CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp);
428 CREATE INDEX /*i*/el_from ON /*_*/externallinks (el_from, el_to(40));
429 CREATE INDEX /*i*/el_to ON /*_*/externallinks (el_to(60), el_from);
430 CREATE INDEX /*i*/el_index ON /*_*/externallinks (el_index(60));
431 CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp);
432 CREATE INDEX /*i*/img_size ON /*_*/image (img_size);
433 CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp);
434 CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1);
435 CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp);
436 CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp);
437 CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14));
438 CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1);
439 CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
440 CREATE INDEX /*i*/fa_group_key ON /*_*/filearchive (fa_storage_group, fa_storage_key);
441 CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
442 CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp);
443 CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp);
444 CREATE INDEX /*i*/rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title);
445 CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id);
446 CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp);
447 CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip);
448 CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text);
449 CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp);
450 CREATE INDEX /*i*/qc_type_value ON /*_*/querycache (qc_type,qc_value);
451 CREATE INDEX /*i*/oc_exptime ON /*_*/objectcache (exptime);
452 CREATE INDEX /*i*/type_time ON /*_*/logging (log_type, log_timestamp);
453 CREATE INDEX /*i*/user_time ON /*_*/logging (log_user, log_timestamp);
454 CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_timestamp);
455 CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp);
456 CREATE INDEX /*i*/job_cmd_namespace_title ON /*_*/job (job_cmd, job_namespace, job_title);
457 CREATE INDEX /*i*/rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from);
458 CREATE INDEX /*i*/qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value);
459 CREATE INDEX /*i*/qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title);
460 CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo);
462 INSERT INTO /*_*/updatelog (ul_key) VALUES ('initial_indexes');