Merge "Vector: Update comments in vector.js"
[mediawiki.git] / maintenance / sqlite / archives / initial-indexes.sql
blob954c85d3f3979d9315ef5552f74f9fd7fe3d7608
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.
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 --------------------------------------------------------------------------------
35 -- Create new tables
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),
53   user_editcount int
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_counter bigint unsigned NOT NULL default 0,
73   page_is_redirect tinyint unsigned NOT NULL default 0,
74   page_is_new tinyint unsigned NOT NULL default 0,
75   page_random real unsigned NOT NULL,
76   page_touched binary(14) NOT NULL default '',
77   page_latest int unsigned NOT NULL,
78   page_len int unsigned NOT NULL
81 CREATE UNIQUE INDEX /*i*/name_title ON /*_*/page_tmp (page_namespace,page_title);
82 CREATE INDEX /*i*/page_random ON /*_*/page_tmp (page_random);
83 CREATE INDEX /*i*/page_len ON /*_*/page_tmp (page_len);
86 CREATE TABLE /*_*/revision_tmp (
87   rev_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
88   rev_page int unsigned NOT NULL,
89   rev_text_id int unsigned NOT NULL,
90   rev_comment tinyblob NOT NULL,
91   rev_user int unsigned NOT NULL default 0,
92   rev_user_text varchar(255) binary NOT NULL default '',
93   rev_timestamp binary(14) NOT NULL default '',
94   rev_minor_edit tinyint unsigned NOT NULL default 0,
95   rev_deleted tinyint unsigned NOT NULL default 0,
96   rev_len int unsigned,
97   rev_parent_id int unsigned default NULL
99 CREATE UNIQUE INDEX /*i*/rev_page_id ON /*_*/revision_tmp (rev_page, rev_id);
100 CREATE INDEX /*i*/rev_timestamp ON /*_*/revision_tmp (rev_timestamp);
101 CREATE INDEX /*i*/page_timestamp ON /*_*/revision_tmp (rev_page,rev_timestamp);
102 CREATE INDEX /*i*/user_timestamp ON /*_*/revision_tmp (rev_user,rev_timestamp);
103 CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision_tmp (rev_user_text,rev_timestamp);
105 CREATE TABLE /*_*/pagelinks_tmp (
106   pl_from int unsigned NOT NULL default 0,
107   pl_namespace int NOT NULL default 0,
108   pl_title varchar(255) binary NOT NULL default ''
111 CREATE UNIQUE INDEX /*i*/pl_from ON /*_*/pagelinks_tmp (pl_from,pl_namespace,pl_title);
112 CREATE INDEX /*i*/pl_namespace_title ON /*_*/pagelinks_tmp (pl_namespace,pl_title,pl_from);
115 CREATE TABLE /*_*/templatelinks_tmp (
116   tl_from int unsigned NOT NULL default 0,
117   tl_namespace int NOT NULL default 0,
118   tl_title varchar(255) binary NOT NULL default ''
121 CREATE UNIQUE INDEX /*i*/tl_from ON /*_*/templatelinks_tmp (tl_from,tl_namespace,tl_title);
122 CREATE INDEX /*i*/tl_namespace_title ON /*_*/templatelinks_tmp (tl_namespace,tl_title,tl_from);
125 CREATE TABLE /*_*/imagelinks_tmp (
126   il_from int unsigned NOT NULL default 0,
127   il_to varchar(255) binary NOT NULL default ''
128 ) /*$wgDBTableOptions*/;
129 CREATE UNIQUE INDEX /*i*/il_from ON /*_*/imagelinks_tmp (il_from,il_to);
130 CREATE INDEX /*i*/il_to ON /*_*/imagelinks_tmp (il_to,il_from);
133 CREATE TABLE /*_*/categorylinks_tmp (
134   cl_from int unsigned NOT NULL default 0,
135   cl_to varchar(255) binary NOT NULL default '',
136   cl_sortkey varchar(70) binary NOT NULL default '',
137   cl_timestamp timestamp NOT NULL
139 CREATE UNIQUE INDEX /*i*/cl_from ON /*_*/categorylinks_tmp (cl_from,cl_to);
140 CREATE INDEX /*i*/cl_sortkey ON /*_*/categorylinks_tmp (cl_to,cl_sortkey,cl_from);
141 CREATE INDEX /*i*/cl_timestamp ON /*_*/categorylinks_tmp (cl_to,cl_timestamp);
144 CREATE TABLE /*_*/category_tmp (
145   cat_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
146   cat_title varchar(255) binary NOT NULL,
147   cat_pages int signed NOT NULL default 0,
148   cat_subcats int signed NOT NULL default 0,
149   cat_files int signed NOT NULL default 0,
150   cat_hidden tinyint unsigned NOT NULL default 0
152 CREATE UNIQUE INDEX /*i*/cat_title ON /*_*/category_tmp (cat_title);
153 CREATE INDEX /*i*/cat_pages ON /*_*/category_tmp (cat_pages);
155 CREATE TABLE /*_*/langlinks_tmp (
156   ll_from int unsigned NOT NULL default 0,
157   ll_lang varbinary(20) NOT NULL default '',
158   ll_title varchar(255) binary NOT NULL default ''
161 CREATE UNIQUE INDEX /*i*/ll_from ON /*_*/langlinks_tmp (ll_from, ll_lang);
162 CREATE INDEX /*i*/ll_lang_title ON /*_*/langlinks_tmp (ll_lang, ll_title);
165 CREATE TABLE /*_*/site_stats_tmp (
166   ss_row_id int unsigned NOT NULL,
167   ss_total_views bigint unsigned default 0,
168   ss_total_edits bigint unsigned default 0,
169   ss_good_articles bigint unsigned default 0,
170   ss_total_pages bigint default '-1',
171   ss_users bigint default '-1',
172   ss_active_users bigint default '-1',
173   ss_admins int default '-1',
174   ss_images int default 0
176 CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats_tmp (ss_row_id);
179 CREATE TABLE /*_*/ipblocks_tmp (
180   ipb_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
181   ipb_address tinyblob NOT NULL,
182   ipb_user int unsigned NOT NULL default 0,
183   ipb_by int unsigned NOT NULL default 0,
184   ipb_by_text varchar(255) binary NOT NULL default '',
185   ipb_reason tinyblob NOT NULL,
186   ipb_timestamp binary(14) NOT NULL default '',
187   ipb_auto bool NOT NULL default 0,
189   -- If set to 1, block applies only to logged-out users
190   ipb_anon_only bool NOT NULL default 0,
191   ipb_create_account bool NOT NULL default 1,
192   ipb_enable_autoblock bool NOT NULL default '1',
193   ipb_expiry varbinary(14) NOT NULL default '',
194   ipb_range_start tinyblob NOT NULL,
195   ipb_range_end tinyblob NOT NULL,
196   ipb_deleted bool NOT NULL default 0,
197   ipb_block_email bool NOT NULL default 0,
198   ipb_allow_usertalk bool NOT NULL default 0
200 CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks_tmp (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only);
201 CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks_tmp (ipb_user);
202 CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks_tmp (ipb_range_start(8), ipb_range_end(8));
203 CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks_tmp (ipb_timestamp);
204 CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks_tmp (ipb_expiry);
207 CREATE TABLE /*_*/watchlist_tmp (
208   wl_user int unsigned NOT NULL,
209   wl_namespace int NOT NULL default 0,
210   wl_title varchar(255) binary NOT NULL default '',
211   wl_notificationtimestamp varbinary(14)
214 CREATE UNIQUE INDEX /*i*/wl_user_namespace_title ON /*_*/watchlist_tmp (wl_user, wl_namespace, wl_title);
215 CREATE INDEX /*i*/namespace_title ON /*_*/watchlist_tmp (wl_namespace, wl_title);
218 CREATE TABLE /*_*/math_tmp (
219   math_inputhash varbinary(16) NOT NULL,
220   math_outputhash varbinary(16) NOT NULL,
221   math_html_conservativeness tinyint NOT NULL,
222   math_html text,
223   math_mathml text
226 CREATE UNIQUE INDEX /*i*/math_inputhash ON /*_*/math_tmp (math_inputhash);
229 CREATE TABLE /*_*/interwiki_tmp (
230   iw_prefix varchar(32) NOT NULL,
231   iw_url blob NOT NULL,
232   iw_local bool NOT NULL,
233   iw_trans tinyint NOT NULL default 0
236 CREATE UNIQUE INDEX /*i*/iw_prefix ON /*_*/interwiki_tmp (iw_prefix);
239 CREATE TABLE /*_*/page_restrictions_tmp (
240   pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
241   pr_page int NOT NULL,
242   pr_type varbinary(60) NOT NULL,
243   pr_level varbinary(60) NOT NULL,
244   pr_cascade tinyint NOT NULL,
245   pr_user int NULL,
246   pr_expiry varbinary(14) NULL
249 CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions_tmp (pr_page,pr_type);
250 CREATE UNIQUE INDEX /*i*/pr_typelevel ON /*_*/page_restrictions_tmp (pr_type,pr_level);
251 CREATE UNIQUE INDEX /*i*/pr_level ON /*_*/page_restrictions_tmp (pr_level);
252 CREATE UNIQUE INDEX /*i*/pr_cascade ON /*_*/page_restrictions_tmp (pr_cascade);
254 CREATE TABLE /*_*/protected_titles_tmp (
255   pt_namespace int NOT NULL,
256   pt_title varchar(255) binary NOT NULL,
257   pt_user int unsigned NOT NULL,
258   pt_reason tinyblob,
259   pt_timestamp binary(14) NOT NULL,
260   pt_expiry varbinary(14) NOT NULL default '',
261   pt_create_perm varbinary(60) NOT NULL
263 CREATE UNIQUE INDEX /*i*/pt_namespace_title ON /*_*/protected_titles_tmp (pt_namespace,pt_title);
264 CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles_tmp (pt_timestamp);
266 CREATE TABLE /*_*/page_props_tmp (
267   pp_page int NOT NULL,
268   pp_propname varbinary(60) NOT NULL,
269   pp_value blob NOT NULL
271 CREATE UNIQUE INDEX /*i*/pp_page_propname ON /*_*/page_props_tmp (pp_page,pp_propname);
274 -- Holding area for deleted articles, which may be viewed
275 -- or restored by admins through the Special:Undelete interface.
276 -- The fields generally correspond to the page, revision, and text
277 -- fields, with several caveats.
278 -- Cannot reasonably create views on this table, due to the presence of TEXT
279 -- columns.
280 CREATE TABLE /*$wgDBprefix*/archive_tmp (
281    ar_id NOT NULL PRIMARY KEY clustered IDENTITY,
282    ar_namespace SMALLINT NOT NULL DEFAULT 0,
283    ar_title NVARCHAR(255) NOT NULL DEFAULT '',
284    ar_text NVARCHAR(MAX) NOT NULL,
285    ar_comment NVARCHAR(255) NOT NULL,
286    ar_user INT NULL REFERENCES /*$wgDBprefix*/[user](user_id) ON DELETE SET NULL,
287    ar_user_text NVARCHAR(255) NOT NULL,
288    ar_timestamp DATETIME NOT NULL DEFAULT GETDATE(),
289    ar_minor_edit BIT NOT NULL DEFAULT 0,
290    ar_flags NVARCHAR(255) NOT NULL,
291    ar_rev_id INT,
292    ar_text_id INT,
293    ar_deleted BIT NOT NULL DEFAULT 0,
294    ar_len INT DEFAULT NULL,
295    ar_page_id INT NULL,
296    ar_parent_id INT NULL
298 CREATE INDEX /*$wgDBprefix*/ar_name_title_timestamp ON /*$wgDBprefix*/archive_tmp(ar_namespace,ar_title,ar_timestamp);
299 CREATE INDEX /*$wgDBprefix*/ar_usertext_timestamp ON /*$wgDBprefix*/archive_tmp(ar_user_text,ar_timestamp);
300 CREATE INDEX /*$wgDBprefix*/ar_user_text    ON /*$wgDBprefix*/archive_tmp(ar_user_text);
303 -- Track links to external URLs
304 -- IE >= 4 supports no more than 2083 characters in a URL
305 CREATE TABLE /*$wgDBprefix*/externallinks_tmp (
306    el_id INT NOT NULL PRIMARY KEY clustered IDENTITY,
307    el_from INT NOT NULL DEFAULT '0',
308    el_to VARCHAR(2083) NOT NULL,
309    el_index VARCHAR(896) NOT NULL,
311 -- Maximum key length ON SQL Server is 900 bytes
312 CREATE INDEX /*$wgDBprefix*/externallinks_index   ON /*$wgDBprefix*/externallinks_tmp(el_index);
314 --------------------------------------------------------------------------------
315 -- Populate the new tables using INSERT SELECT
316 --------------------------------------------------------------------------------
318 INSERT OR IGNORE INTO /*_*/user_tmp SELECT * FROM /*_*/user;
319 INSERT OR IGNORE INTO /*_*/user_groups_tmp SELECT * FROM /*_*/user_groups;
320 INSERT OR IGNORE INTO /*_*/page_tmp SELECT * FROM /*_*/page;
321 INSERT OR IGNORE INTO /*_*/revision_tmp SELECT * FROM /*_*/revision;
322 INSERT OR IGNORE INTO /*_*/pagelinks_tmp SELECT * FROM /*_*/pagelinks;
323 INSERT OR IGNORE INTO /*_*/templatelinks_tmp SELECT * FROM /*_*/templatelinks;
324 INSERT OR IGNORE INTO /*_*/imagelinks_tmp SELECT * FROM /*_*/imagelinks;
325 INSERT OR IGNORE INTO /*_*/categorylinks_tmp SELECT * FROM /*_*/categorylinks;
326 INSERT OR IGNORE INTO /*_*/category_tmp SELECT * FROM /*_*/category;
327 INSERT OR IGNORE INTO /*_*/langlinks_tmp SELECT * FROM /*_*/langlinks;
328 INSERT OR IGNORE INTO /*_*/site_stats_tmp SELECT * FROM /*_*/site_stats;
329 INSERT OR IGNORE INTO /*_*/ipblocks_tmp SELECT * FROM /*_*/ipblocks;
330 INSERT OR IGNORE INTO /*_*/watchlist_tmp SELECT * FROM /*_*/watchlist;
331 INSERT OR IGNORE INTO /*_*/math_tmp SELECT * FROM /*_*/math;
332 INSERT OR IGNORE INTO /*_*/interwiki_tmp SELECT * FROM /*_*/interwiki;
333 INSERT OR IGNORE INTO /*_*/page_restrictions_tmp SELECT * FROM /*_*/page_restrictions;
334 INSERT OR IGNORE INTO /*_*/protected_titles_tmp SELECT * FROM /*_*/protected_titles;
335 INSERT OR IGNORE INTO /*_*/page_props_tmp SELECT * FROM /*_*/page_props;
336 INSERT OR IGNORE INTO /*_*/archive_tmp SELECT * FROM /*_*/archive;
337 INSERT OR IGNORE INTO /*_*/externallinks_tmp SELECT * FROM /*_*/externallinks;
339 --------------------------------------------------------------------------------
340 -- Do the table renames
341 --------------------------------------------------------------------------------
343 DROP TABLE /*_*/user;
344 ALTER TABLE /*_*/user_tmp RENAME TO /*_*/user;
345 DROP TABLE /*_*/user_groups;
346 ALTER TABLE /*_*/user_groups_tmp RENAME TO /*_*/user_groups;
347 DROP TABLE /*_*/page;
348 ALTER TABLE /*_*/page_tmp RENAME TO /*_*/page;
349 DROP TABLE /*_*/revision;
350 ALTER TABLE /*_*/revision_tmp RENAME TO /*_*/revision;
351 DROP TABLE /*_*/pagelinks;
352 ALTER TABLE /*_*/pagelinks_tmp RENAME TO /*_*/pagelinks;
353 DROP TABLE /*_*/templatelinks;
354 ALTER TABLE /*_*/templatelinks_tmp RENAME TO /*_*/templatelinks;
355 DROP TABLE /*_*/imagelinks;
356 ALTER TABLE /*_*/imagelinks_tmp RENAME TO /*_*/imagelinks;
357 DROP TABLE /*_*/categorylinks;
358 ALTER TABLE /*_*/categorylinks_tmp RENAME TO /*_*/categorylinks;
359 DROP TABLE /*_*/category;
360 ALTER TABLE /*_*/category_tmp RENAME TO /*_*/category;
361 DROP TABLE /*_*/langlinks;
362 ALTER TABLE /*_*/langlinks_tmp RENAME TO /*_*/langlinks;
363 DROP TABLE /*_*/site_stats;
364 ALTER TABLE /*_*/site_stats_tmp RENAME TO /*_*/site_stats;
365 DROP TABLE /*_*/ipblocks;
366 ALTER TABLE /*_*/ipblocks_tmp RENAME TO /*_*/ipblocks;
367 DROP TABLE /*_*/watchlist;
368 ALTER TABLE /*_*/watchlist_tmp RENAME TO /*_*/watchlist;
369 DROP TABLE /*_*/math;
370 ALTER TABLE /*_*/math_tmp RENAME TO /*_*/math;
371 DROP TABLE /*_*/interwiki;
372 ALTER TABLE /*_*/interwiki_tmp RENAME TO /*_*/interwiki;
373 DROP TABLE /*_*/page_restrictions;
374 ALTER TABLE /*_*/page_restrictions_tmp RENAME TO /*_*/page_restrictions;
375 DROP TABLE /*_*/protected_titles;
376 ALTER TABLE /*_*/protected_titles_tmp RENAME TO /*_*/protected_titles;
377 DROP TABLE /*_*/page_props;
378 ALTER TABLE /*_*/page_props_tmp RENAME TO /*_*/page_props;
379 DROP TABLE /*_*/archive;
380 ALTER TABLE /*_*/archive_tmp RENAME TO /*_*/archive;
381 DROP TABLE /*_*/externalllinks;
382 ALTER TABLE /*_*/externallinks_tmp RENAME TO /*_*/externallinks;
384 --------------------------------------------------------------------------------
385 -- Drop and create tables with unique indexes but no valuable data
386 --------------------------------------------------------------------------------
389 DROP TABLE IF EXISTS /*_*/searchindex;
390 CREATE TABLE /*_*/searchindex (
391   si_page int unsigned NOT NULL,
392   si_title varchar(255) NOT NULL default '',
393   si_text mediumtext NOT NULL
395 CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex (si_page);
396 CREATE INDEX /*i*/si_title ON /*_*/searchindex (si_title);
397 CREATE INDEX /*i*/si_text ON /*_*/searchindex (si_text);
399 DROP TABLE IF EXISTS /*_*/transcache;
400 CREATE TABLE /*_*/transcache (
401   tc_url varbinary(255) NOT NULL,
402   tc_contents text,
403   tc_time int NOT NULL
404 ) /*$wgDBTableOptions*/;
405 CREATE UNIQUE INDEX /*i*/tc_url_idx ON /*_*/transcache (tc_url);
407 DROP TABLE IF EXISTS /*_*/querycache_info;
408 CREATE TABLE /*_*/querycache_info (
409   qci_type varbinary(32) NOT NULL default '',
410   qci_timestamp binary(14) NOT NULL default '19700101000000'
411 ) /*$wgDBTableOptions*/;
412 CREATE UNIQUE INDEX /*i*/qci_type ON /*_*/querycache_info (qci_type);
414 --------------------------------------------------------------------------------
415 -- Empty some cache tables to make the update faster
416 --------------------------------------------------------------------------------
418 DELETE FROM /*_*/querycache;
419 DELETE FROM /*_*/objectcache;
420 DELETE FROM /*_*/querycachetwo;
422 --------------------------------------------------------------------------------
423 -- Add indexes to tables with no unique indexes
424 --------------------------------------------------------------------------------
426 CREATE INDEX /*i*/un_user_id ON /*_*/user_newtalk (user_id);
427 CREATE INDEX /*i*/un_user_ip ON /*_*/user_newtalk (user_ip);
428 CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
429 CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp);
430 CREATE INDEX /*i*/el_from ON /*_*/externallinks (el_from, el_to(40));
431 CREATE INDEX /*i*/el_to ON /*_*/externallinks (el_to(60), el_from);
432 CREATE INDEX /*i*/el_index ON /*_*/externallinks (el_index(60));
433 CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp);
434 CREATE INDEX /*i*/img_size ON /*_*/image (img_size);
435 CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp);
436 CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1);
437 CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp);
438 CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp);
439 CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14));
440 CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1);
441 CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
442 CREATE INDEX /*i*/fa_group_key ON /*_*/filearchive (fa_storage_group, fa_storage_key);
443 CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
444 CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp);
445 CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp);
446 CREATE INDEX /*i*/rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title);
447 CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id);
448 CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp);
449 CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip);
450 CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text);
451 CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp);
452 CREATE INDEX /*i*/qc_type_value ON /*_*/querycache (qc_type,qc_value);
453 CREATE INDEX /*i*/oc_exptime ON /*_*/objectcache (exptime);
454 CREATE INDEX /*i*/type_time ON /*_*/logging (log_type, log_timestamp);
455 CREATE INDEX /*i*/user_time ON /*_*/logging (log_user, log_timestamp);
456 CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_timestamp);
457 CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp);
458 CREATE INDEX /*i*/job_cmd_namespace_title ON /*_*/job (job_cmd, job_namespace, job_title);
459 CREATE INDEX /*i*/rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from);
460 CREATE INDEX /*i*/qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value);
461 CREATE INDEX /*i*/qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title);
462 CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo);
464 INSERT INTO /*_*/updatelog (ul_key) VALUES ('initial_indexes');