Added SQLite version of the patch since the other one has syntax errors on SQLite
[lhc/web/wiklou.git] / maintenance / sqlite / archives / initial-indexes.sql
1 -- Correct for the total lack of indexes in the MW 1.13 SQLite schema
2 --
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.
5 --
6 -- Ignore duplicates, several tables will have them (e.g. bug 16966) but in
7 -- most cases it's harmless to discard them.
8
9 --------------------------------------------------------------------------------
10 -- Drop temporary tables from aborted runs
11 --------------------------------------------------------------------------------
12
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
32 --------------------------------------------------------------------------------
33 -- Create new tables
34 --------------------------------------------------------------------------------
35
36 CREATE TABLE /*_*/user_tmp (
37 user_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
38 user_name varchar(255) binary NOT NULL default '',
39 user_real_name varchar(255) binary NOT NULL default '',
40 user_password tinyblob NOT NULL,
41 user_newpassword tinyblob NOT NULL,
42 user_newpass_time binary(14),
43 user_email tinytext NOT NULL,
44 user_options blob NOT NULL,
45 user_touched binary(14) NOT NULL default '',
46 user_token binary(32) NOT NULL default '',
47 user_email_authenticated binary(14),
48 user_email_token binary(32),
49 user_email_token_expires binary(14),
50 user_registration binary(14),
51 user_editcount int
52 );
53 CREATE UNIQUE INDEX /*i*/user_name ON /*_*/user_tmp (user_name);
54 CREATE INDEX /*i*/user_email_token ON /*_*/user_tmp (user_email_token);
55
56
57 CREATE TABLE /*_*/user_groups_tmp (
58 ug_user int unsigned NOT NULL default 0,
59 ug_group varbinary(16) NOT NULL default ''
60 );
61
62 CREATE UNIQUE INDEX /*i*/ug_user_group ON /*_*/user_groups_tmp (ug_user,ug_group);
63 CREATE INDEX /*i*/ug_group ON /*_*/user_groups_tmp (ug_group);
64
65 CREATE TABLE /*_*/page_tmp (
66 page_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
67 page_namespace int NOT NULL,
68 page_title varchar(255) binary NOT NULL,
69 page_restrictions tinyblob NOT NULL,
70 page_counter bigint unsigned NOT NULL default 0,
71 page_is_redirect tinyint unsigned NOT NULL default 0,
72 page_is_new tinyint unsigned NOT NULL default 0,
73 page_random real unsigned NOT NULL,
74 page_touched binary(14) NOT NULL default '',
75 page_latest int unsigned NOT NULL,
76 page_len int unsigned NOT NULL
77 );
78
79 CREATE UNIQUE INDEX /*i*/name_title ON /*_*/page_tmp (page_namespace,page_title);
80 CREATE INDEX /*i*/page_random ON /*_*/page_tmp (page_random);
81 CREATE INDEX /*i*/page_len ON /*_*/page_tmp (page_len);
82
83
84 CREATE TABLE /*_*/revision_tmp (
85 rev_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
86 rev_page int unsigned NOT NULL,
87 rev_text_id int unsigned NOT NULL,
88 rev_comment tinyblob NOT NULL,
89 rev_user int unsigned NOT NULL default 0,
90 rev_user_text varchar(255) binary NOT NULL default '',
91 rev_timestamp binary(14) NOT NULL default '',
92 rev_minor_edit tinyint unsigned NOT NULL default 0,
93 rev_deleted tinyint unsigned NOT NULL default 0,
94 rev_len int unsigned,
95 rev_parent_id int unsigned default NULL
96 );
97 CREATE UNIQUE INDEX /*i*/rev_page_id ON /*_*/revision_tmp (rev_page, rev_id);
98 CREATE INDEX /*i*/rev_timestamp ON /*_*/revision_tmp (rev_timestamp);
99 CREATE INDEX /*i*/page_timestamp ON /*_*/revision_tmp (rev_page,rev_timestamp);
100 CREATE INDEX /*i*/user_timestamp ON /*_*/revision_tmp (rev_user,rev_timestamp);
101 CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision_tmp (rev_user_text,rev_timestamp);
102
103 CREATE TABLE /*_*/pagelinks_tmp (
104 pl_from int unsigned NOT NULL default 0,
105 pl_namespace int NOT NULL default 0,
106 pl_title varchar(255) binary NOT NULL default ''
107 );
108
109 CREATE UNIQUE INDEX /*i*/pl_from ON /*_*/pagelinks_tmp (pl_from,pl_namespace,pl_title);
110 CREATE INDEX /*i*/pl_namespace_title ON /*_*/pagelinks_tmp (pl_namespace,pl_title,pl_from);
111
112
113 CREATE TABLE /*_*/templatelinks_tmp (
114 tl_from int unsigned NOT NULL default 0,
115 tl_namespace int NOT NULL default 0,
116 tl_title varchar(255) binary NOT NULL default ''
117 );
118
119 CREATE UNIQUE INDEX /*i*/tl_from ON /*_*/templatelinks_tmp (tl_from,tl_namespace,tl_title);
120 CREATE INDEX /*i*/tl_namespace_title ON /*_*/templatelinks_tmp (tl_namespace,tl_title,tl_from);
121
122
123 CREATE TABLE /*_*/imagelinks_tmp (
124 il_from int unsigned NOT NULL default 0,
125 il_to varchar(255) binary NOT NULL default ''
126 ) /*$wgDBTableOptions*/;
127 CREATE UNIQUE INDEX /*i*/il_from ON /*_*/imagelinks_tmp (il_from,il_to);
128 CREATE INDEX /*i*/il_to ON /*_*/imagelinks_tmp (il_to,il_from);
129
130
131 CREATE TABLE /*_*/categorylinks_tmp (
132 cl_from int unsigned NOT NULL default 0,
133 cl_to varchar(255) binary NOT NULL default '',
134 cl_sortkey varchar(70) binary NOT NULL default '',
135 cl_timestamp timestamp NOT NULL
136 );
137 CREATE UNIQUE INDEX /*i*/cl_from ON /*_*/categorylinks_tmp (cl_from,cl_to);
138 CREATE INDEX /*i*/cl_sortkey ON /*_*/categorylinks_tmp (cl_to,cl_sortkey,cl_from);
139 CREATE INDEX /*i*/cl_timestamp ON /*_*/categorylinks_tmp (cl_to,cl_timestamp);
140
141
142 CREATE TABLE /*_*/category_tmp (
143 cat_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
144 cat_title varchar(255) binary NOT NULL,
145 cat_pages int signed NOT NULL default 0,
146 cat_subcats int signed NOT NULL default 0,
147 cat_files int signed NOT NULL default 0,
148 cat_hidden tinyint unsigned NOT NULL default 0
149 );
150 CREATE UNIQUE INDEX /*i*/cat_title ON /*_*/category_tmp (cat_title);
151 CREATE INDEX /*i*/cat_pages ON /*_*/category_tmp (cat_pages);
152
153 CREATE TABLE /*_*/langlinks_tmp (
154 ll_from int unsigned NOT NULL default 0,
155 ll_lang varbinary(20) NOT NULL default '',
156 ll_title varchar(255) binary NOT NULL default ''
157 );
158
159 CREATE UNIQUE INDEX /*i*/ll_from ON /*_*/langlinks_tmp (ll_from, ll_lang);
160 CREATE INDEX /*i*/ll_lang_title ON /*_*/langlinks_tmp (ll_lang, ll_title);
161
162
163 CREATE TABLE /*_*/site_stats_tmp (
164 ss_row_id int unsigned NOT NULL,
165 ss_total_views bigint unsigned default 0,
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
173 );
174 CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats_tmp (ss_row_id);
175
176
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,
186
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
197 );
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);
203
204
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)
210 );
211
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);
214
215
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,
220 math_html text,
221 math_mathml text
222 );
223
224 CREATE UNIQUE INDEX /*i*/math_inputhash ON /*_*/math_tmp (math_inputhash);
225
226
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
232 );
233
234 CREATE UNIQUE INDEX /*i*/iw_prefix ON /*_*/interwiki_tmp (iw_prefix);
235
236
237 CREATE TABLE /*_*/page_restrictions_tmp (
238 pr_page int NOT NULL,
239 pr_type varbinary(60) NOT NULL,
240 pr_level varbinary(60) NOT NULL,
241 pr_cascade tinyint NOT NULL,
242 pr_user int NULL,
243 pr_expiry varbinary(14) NULL,
244 pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT
245 );
246
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);
251
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,
256 pt_reason tinyblob,
257 pt_timestamp binary(14) NOT NULL,
258 pt_expiry varbinary(14) NOT NULL default '',
259 pt_create_perm varbinary(60) NOT NULL
260 );
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);
263
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
268 );
269 CREATE UNIQUE INDEX /*i*/pp_page_propname ON /*_*/page_props_tmp (pp_page,pp_propname);
270
271 --------------------------------------------------------------------------------
272 -- Populate the new tables using INSERT SELECT
273 --------------------------------------------------------------------------------
274
275 INSERT OR IGNORE INTO /*_*/user_tmp SELECT * FROM /*_*/user;
276 INSERT OR IGNORE INTO /*_*/user_groups_tmp SELECT * FROM /*_*/user_groups;
277 INSERT OR IGNORE INTO /*_*/page_tmp SELECT * FROM /*_*/page;
278 INSERT OR IGNORE INTO /*_*/revision_tmp SELECT * FROM /*_*/revision;
279 INSERT OR IGNORE INTO /*_*/pagelinks_tmp SELECT * FROM /*_*/pagelinks;
280 INSERT OR IGNORE INTO /*_*/templatelinks_tmp SELECT * FROM /*_*/templatelinks;
281 INSERT OR IGNORE INTO /*_*/imagelinks_tmp SELECT * FROM /*_*/imagelinks;
282 INSERT OR IGNORE INTO /*_*/categorylinks_tmp SELECT * FROM /*_*/categorylinks;
283 INSERT OR IGNORE INTO /*_*/category_tmp SELECT * FROM /*_*/category;
284 INSERT OR IGNORE INTO /*_*/langlinks_tmp SELECT * FROM /*_*/langlinks;
285 INSERT OR IGNORE INTO /*_*/site_stats_tmp SELECT * FROM /*_*/site_stats;
286 INSERT OR IGNORE INTO /*_*/ipblocks_tmp SELECT * FROM /*_*/ipblocks;
287 INSERT OR IGNORE INTO /*_*/watchlist_tmp SELECT * FROM /*_*/watchlist;
288 INSERT OR IGNORE INTO /*_*/math_tmp SELECT * FROM /*_*/math;
289 INSERT OR IGNORE INTO /*_*/interwiki_tmp SELECT * FROM /*_*/interwiki;
290 INSERT OR IGNORE INTO /*_*/page_restrictions_tmp SELECT * FROM /*_*/page_restrictions;
291 INSERT OR IGNORE INTO /*_*/protected_titles_tmp SELECT * FROM /*_*/protected_titles;
292 INSERT OR IGNORE INTO /*_*/page_props_tmp SELECT * FROM /*_*/page_props;
293
294 --------------------------------------------------------------------------------
295 -- Do the table renames
296 --------------------------------------------------------------------------------
297
298 DROP TABLE /*_*/user;
299 ALTER TABLE /*_*/user_tmp RENAME TO /*_*/user;
300 DROP TABLE /*_*/user_groups;
301 ALTER TABLE /*_*/user_groups_tmp RENAME TO /*_*/user_groups;
302 DROP TABLE /*_*/page;
303 ALTER TABLE /*_*/page_tmp RENAME TO /*_*/page;
304 DROP TABLE /*_*/revision;
305 ALTER TABLE /*_*/revision_tmp RENAME TO /*_*/revision;
306 DROP TABLE /*_*/pagelinks;
307 ALTER TABLE /*_*/pagelinks_tmp RENAME TO /*_*/pagelinks;
308 DROP TABLE /*_*/templatelinks;
309 ALTER TABLE /*_*/templatelinks_tmp RENAME TO /*_*/templatelinks;
310 DROP TABLE /*_*/imagelinks;
311 ALTER TABLE /*_*/imagelinks_tmp RENAME TO /*_*/imagelinks;
312 DROP TABLE /*_*/categorylinks;
313 ALTER TABLE /*_*/categorylinks_tmp RENAME TO /*_*/categorylinks;
314 DROP TABLE /*_*/category;
315 ALTER TABLE /*_*/category_tmp RENAME TO /*_*/category;
316 DROP TABLE /*_*/langlinks;
317 ALTER TABLE /*_*/langlinks_tmp RENAME TO /*_*/langlinks;
318 DROP TABLE /*_*/site_stats;
319 ALTER TABLE /*_*/site_stats_tmp RENAME TO /*_*/site_stats;
320 DROP TABLE /*_*/ipblocks;
321 ALTER TABLE /*_*/ipblocks_tmp RENAME TO /*_*/ipblocks;
322 DROP TABLE /*_*/watchlist;
323 ALTER TABLE /*_*/watchlist_tmp RENAME TO /*_*/watchlist;
324 DROP TABLE /*_*/math;
325 ALTER TABLE /*_*/math_tmp RENAME TO /*_*/math;
326 DROP TABLE /*_*/interwiki;
327 ALTER TABLE /*_*/interwiki_tmp RENAME TO /*_*/interwiki;
328 DROP TABLE /*_*/page_restrictions;
329 ALTER TABLE /*_*/page_restrictions_tmp RENAME TO /*_*/page_restrictions;
330 DROP TABLE /*_*/protected_titles;
331 ALTER TABLE /*_*/protected_titles_tmp RENAME TO /*_*/protected_titles;
332 DROP TABLE /*_*/page_props;
333 ALTER TABLE /*_*/page_props_tmp RENAME TO /*_*/page_props;
334
335 --------------------------------------------------------------------------------
336 -- Drop and create tables with unique indexes but no valuable data
337 --------------------------------------------------------------------------------
338
339
340 DROP TABLE IF EXISTS /*_*/searchindex;
341 CREATE TABLE /*_*/searchindex (
342 si_page int unsigned NOT NULL,
343 si_title varchar(255) NOT NULL default '',
344 si_text mediumtext NOT NULL
345 );
346 CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex (si_page);
347 CREATE INDEX /*i*/si_title ON /*_*/searchindex (si_title);
348 CREATE INDEX /*i*/si_text ON /*_*/searchindex (si_text);
349
350 DROP TABLE IF EXISTS /*_*/transcache;
351 CREATE TABLE /*_*/transcache (
352 tc_url varbinary(255) NOT NULL,
353 tc_contents text,
354 tc_time int NOT NULL
355 ) /*$wgDBTableOptions*/;
356 CREATE UNIQUE INDEX /*i*/tc_url_idx ON /*_*/transcache (tc_url);
357
358 DROP TABLE IF EXISTS /*_*/querycache_info;
359 CREATE TABLE /*_*/querycache_info (
360 qci_type varbinary(32) NOT NULL default '',
361 qci_timestamp binary(14) NOT NULL default '19700101000000'
362 ) /*$wgDBTableOptions*/;
363 CREATE UNIQUE INDEX /*i*/qci_type ON /*_*/querycache_info (qci_type);
364
365 --------------------------------------------------------------------------------
366 -- Empty some cache tables to make the update faster
367 --------------------------------------------------------------------------------
368
369 DELETE FROM /*_*/querycache;
370 DELETE FROM /*_*/objectcache;
371 DELETE FROM /*_*/querycachetwo;
372
373 --------------------------------------------------------------------------------
374 -- Add indexes to tables with no unique indexes
375 --------------------------------------------------------------------------------
376
377 CREATE INDEX /*i*/un_user_id ON /*_*/user_newtalk (user_id);
378 CREATE INDEX /*i*/un_user_ip ON /*_*/user_newtalk (user_ip);
379 CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
380 CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp);
381 CREATE INDEX /*i*/el_from ON /*_*/externallinks (el_from, el_to(40));
382 CREATE INDEX /*i*/el_to ON /*_*/externallinks (el_to(60), el_from);
383 CREATE INDEX /*i*/el_index ON /*_*/externallinks (el_index(60));
384 CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp);
385 CREATE INDEX /*i*/img_size ON /*_*/image (img_size);
386 CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp);
387 CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1);
388 CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp);
389 CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp);
390 CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14));
391 CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1);
392 CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
393 CREATE INDEX /*i*/fa_group_key ON /*_*/filearchive (fa_storage_group, fa_storage_key);
394 CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
395 CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp);
396 CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp);
397 CREATE INDEX /*i*/rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title);
398 CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id);
399 CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp);
400 CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip);
401 CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text);
402 CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp);
403 CREATE INDEX /*i*/qc_type_value ON /*_*/querycache (qc_type,qc_value);
404 CREATE INDEX /*i*/oc_exptime ON /*_*/objectcache (exptime);
405 CREATE INDEX /*i*/type_time ON /*_*/logging (log_type, log_timestamp);
406 CREATE INDEX /*i*/user_time ON /*_*/logging (log_user, log_timestamp);
407 CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_timestamp);
408 CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp);
409 CREATE INDEX /*i*/tb_page ON /*_*/trackbacks (tb_page);
410 CREATE INDEX /*i*/job_cmd_namespace_title ON /*_*/job (job_cmd, job_namespace, job_title);
411 CREATE INDEX /*i*/rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from);
412 CREATE INDEX /*i*/qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value);
413 CREATE INDEX /*i*/qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title);
414 CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo);
415
416 INSERT INTO /*_*/updatelog (ul_key) VALUES ('initial_indexes');