Index: trunk/phase3/maintenance/sqlite/archives/initial-indexes.sql |
— | — | @@ -51,8 +51,8 @@ |
52 | 52 | user_registration binary(14), |
53 | 53 | user_editcount int |
54 | 54 | ); |
55 | | -CREATE UNIQUE INDEX user_name ON /*_*/user_tmp (user_name); |
56 | | -CREATE INDEX user_email_token ON /*_*/user_tmp (user_email_token); |
| 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); |
57 | 57 | |
58 | 58 | |
59 | 59 | CREATE TABLE /*_*/user_groups_tmp ( |
— | — | @@ -60,8 +60,8 @@ |
61 | 61 | ug_group varbinary(16) NOT NULL default '' |
62 | 62 | ); |
63 | 63 | |
64 | | -CREATE UNIQUE INDEX ug_user_group ON /*_*/user_groups_tmp (ug_user,ug_group); |
65 | | -CREATE INDEX ug_group ON /*_*/user_groups_tmp (ug_group); |
| 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); |
66 | 66 | |
67 | 67 | CREATE TABLE /*_*/page_tmp ( |
68 | 68 | page_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, |
— | — | @@ -77,9 +77,9 @@ |
78 | 78 | page_len int unsigned NOT NULL |
79 | 79 | ); |
80 | 80 | |
81 | | -CREATE UNIQUE INDEX name_title ON /*_*/page_tmp (page_namespace,page_title); |
82 | | -CREATE INDEX page_random ON /*_*/page_tmp (page_random); |
83 | | -CREATE INDEX page_len ON /*_*/page_tmp (page_len); |
| 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); |
84 | 84 | |
85 | 85 | |
86 | 86 | CREATE TABLE /*_*/revision_tmp ( |
— | — | @@ -95,11 +95,11 @@ |
96 | 96 | rev_len int unsigned, |
97 | 97 | rev_parent_id int unsigned default NULL |
98 | 98 | ); |
99 | | -CREATE UNIQUE INDEX rev_page_id ON /*_*/revision_tmp (rev_page, rev_id); |
100 | | -CREATE INDEX rev_timestamp ON /*_*/revision_tmp (rev_timestamp); |
101 | | -CREATE INDEX page_timestamp ON /*_*/revision_tmp (rev_page,rev_timestamp); |
102 | | -CREATE INDEX user_timestamp ON /*_*/revision_tmp (rev_user,rev_timestamp); |
103 | | -CREATE INDEX usertext_timestamp ON /*_*/revision_tmp (rev_user_text,rev_timestamp); |
| 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); |
104 | 104 | |
105 | 105 | CREATE TABLE /*_*/pagelinks_tmp ( |
106 | 106 | pl_from int unsigned NOT NULL default 0, |
— | — | @@ -107,8 +107,8 @@ |
108 | 108 | pl_title varchar(255) binary NOT NULL default '' |
109 | 109 | ); |
110 | 110 | |
111 | | -CREATE UNIQUE INDEX pl_from ON /*_*/pagelinks_tmp (pl_from,pl_namespace,pl_title); |
112 | | -CREATE INDEX pl_namespace_title ON /*_*/pagelinks_tmp (pl_namespace,pl_title,pl_from); |
| 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); |
113 | 113 | |
114 | 114 | |
115 | 115 | CREATE TABLE /*_*/templatelinks_tmp ( |
— | — | @@ -117,16 +117,16 @@ |
118 | 118 | tl_title varchar(255) binary NOT NULL default '' |
119 | 119 | ); |
120 | 120 | |
121 | | -CREATE UNIQUE INDEX tl_from ON /*_*/templatelinks_tmp (tl_from,tl_namespace,tl_title); |
122 | | -CREATE INDEX tl_namespace_title ON /*_*/templatelinks_tmp (tl_namespace,tl_title,tl_from); |
| 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); |
123 | 123 | |
124 | 124 | |
125 | 125 | CREATE TABLE /*_*/imagelinks_tmp ( |
126 | 126 | il_from int unsigned NOT NULL default 0, |
127 | 127 | il_to varchar(255) binary NOT NULL default '' |
128 | 128 | ) /*$wgDBTableOptions*/; |
129 | | -CREATE UNIQUE INDEX il_from ON /*_*/imagelinks_tmp (il_from,il_to); |
130 | | -CREATE INDEX il_to ON /*_*/imagelinks_tmp (il_to,il_from); |
| 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); |
131 | 131 | |
132 | 132 | |
133 | 133 | CREATE TABLE /*_*/categorylinks_tmp ( |
— | — | @@ -135,9 +135,9 @@ |
136 | 136 | cl_sortkey varchar(70) binary NOT NULL default '', |
137 | 137 | cl_timestamp timestamp NOT NULL |
138 | 138 | ); |
139 | | -CREATE UNIQUE INDEX cl_from ON /*_*/categorylinks_tmp (cl_from,cl_to); |
140 | | -CREATE INDEX cl_sortkey ON /*_*/categorylinks_tmp (cl_to,cl_sortkey,cl_from); |
141 | | -CREATE INDEX cl_timestamp ON /*_*/categorylinks_tmp (cl_to,cl_timestamp); |
| 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); |
142 | 142 | |
143 | 143 | |
144 | 144 | CREATE TABLE /*_*/category_tmp ( |
— | — | @@ -148,8 +148,8 @@ |
149 | 149 | cat_files int signed NOT NULL default 0, |
150 | 150 | cat_hidden tinyint unsigned NOT NULL default 0 |
151 | 151 | ); |
152 | | -CREATE UNIQUE INDEX cat_title ON /*_*/category_tmp (cat_title); |
153 | | -CREATE INDEX cat_pages ON /*_*/category_tmp (cat_pages); |
| 152 | +CREATE UNIQUE INDEX /*i*/cat_title ON /*_*/category_tmp (cat_title); |
| 153 | +CREATE INDEX /*i*/cat_pages ON /*_*/category_tmp (cat_pages); |
154 | 154 | |
155 | 155 | CREATE TABLE /*_*/langlinks_tmp ( |
156 | 156 | ll_from int unsigned NOT NULL default 0, |
— | — | @@ -157,8 +157,8 @@ |
158 | 158 | ll_title varchar(255) binary NOT NULL default '' |
159 | 159 | ); |
160 | 160 | |
161 | | -CREATE UNIQUE INDEX ll_from ON /*_*/langlinks_tmp (ll_from, ll_lang); |
162 | | -CREATE INDEX ll_lang_title ON /*_*/langlinks_tmp (ll_lang, ll_title); |
| 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); |
163 | 163 | |
164 | 164 | |
165 | 165 | CREATE TABLE /*_*/site_stats_tmp ( |
— | — | @@ -172,7 +172,7 @@ |
173 | 173 | ss_admins int default '-1', |
174 | 174 | ss_images int default 0 |
175 | 175 | ); |
176 | | -CREATE UNIQUE INDEX ss_row_id ON /*_*/site_stats_tmp (ss_row_id); |
| 176 | +CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats_tmp (ss_row_id); |
177 | 177 | |
178 | 178 | |
179 | 179 | CREATE TABLE /*_*/ipblocks_tmp ( |
— | — | @@ -196,11 +196,11 @@ |
197 | 197 | ipb_block_email bool NOT NULL default 0, |
198 | 198 | ipb_allow_usertalk bool NOT NULL default 0 |
199 | 199 | ); |
200 | | -CREATE UNIQUE INDEX ipb_address ON /*_*/ipblocks_tmp (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only); |
201 | | -CREATE INDEX ipb_user ON /*_*/ipblocks_tmp (ipb_user); |
202 | | -CREATE INDEX ipb_range ON /*_*/ipblocks_tmp (ipb_range_start(8), ipb_range_end(8)); |
203 | | -CREATE INDEX ipb_timestamp ON /*_*/ipblocks_tmp (ipb_timestamp); |
204 | | -CREATE INDEX ipb_expiry ON /*_*/ipblocks_tmp (ipb_expiry); |
| 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); |
205 | 205 | |
206 | 206 | |
207 | 207 | CREATE TABLE /*_*/watchlist_tmp ( |
— | — | @@ -210,8 +210,8 @@ |
211 | 211 | wl_notificationtimestamp varbinary(14) |
212 | 212 | ); |
213 | 213 | |
214 | | -CREATE UNIQUE INDEX wl_user_namespace_title ON /*_*/watchlist_tmp (wl_user, wl_namespace, wl_title); |
215 | | -CREATE INDEX namespace_title ON /*_*/watchlist_tmp (wl_namespace, wl_title); |
| 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); |
216 | 216 | |
217 | 217 | |
218 | 218 | CREATE TABLE /*_*/math_tmp ( |
— | — | @@ -222,7 +222,7 @@ |
223 | 223 | math_mathml text |
224 | 224 | ); |
225 | 225 | |
226 | | -CREATE UNIQUE INDEX math_inputhash ON /*_*/math_tmp (math_inputhash); |
| 226 | +CREATE UNIQUE INDEX /*i*/math_inputhash ON /*_*/math_tmp (math_inputhash); |
227 | 227 | |
228 | 228 | |
229 | 229 | CREATE TABLE /*_*/interwiki_tmp ( |
— | — | @@ -232,7 +232,7 @@ |
233 | 233 | iw_trans tinyint NOT NULL default 0 |
234 | 234 | ); |
235 | 235 | |
236 | | -CREATE UNIQUE INDEX iw_prefix ON /*_*/interwiki_tmp (iw_prefix); |
| 236 | +CREATE UNIQUE INDEX /*i*/iw_prefix ON /*_*/interwiki_tmp (iw_prefix); |
237 | 237 | |
238 | 238 | |
239 | 239 | CREATE TABLE /*_*/page_restrictions_tmp ( |
— | — | @@ -245,10 +245,10 @@ |
246 | 246 | pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT |
247 | 247 | ); |
248 | 248 | |
249 | | -CREATE UNIQUE INDEX pr_pagetype ON /*_*/page_restrictions_tmp (pr_page,pr_type); |
250 | | -CREATE UNIQUE INDEX pr_typelevel ON /*_*/page_restrictions_tmp (pr_type,pr_level); |
251 | | -CREATE UNIQUE INDEX pr_level ON /*_*/page_restrictions_tmp (pr_level); |
252 | | -CREATE UNIQUE INDEX pr_cascade ON /*_*/page_restrictions_tmp (pr_cascade); |
| 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); |
253 | 253 | |
254 | 254 | CREATE TABLE /*_*/protected_titles_tmp ( |
255 | 255 | pt_namespace int NOT NULL, |
— | — | @@ -259,15 +259,15 @@ |
260 | 260 | pt_expiry varbinary(14) NOT NULL default '', |
261 | 261 | pt_create_perm varbinary(60) NOT NULL |
262 | 262 | ); |
263 | | -CREATE UNIQUE INDEX pt_namespace_title ON /*_*/protected_titles_tmp (pt_namespace,pt_title); |
264 | | -CREATE INDEX pt_timestamp ON /*_*/protected_titles_tmp (pt_timestamp); |
| 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); |
265 | 265 | |
266 | 266 | CREATE TABLE /*_*/page_props_tmp ( |
267 | 267 | pp_page int NOT NULL, |
268 | 268 | pp_propname varbinary(60) NOT NULL, |
269 | 269 | pp_value blob NOT NULL |
270 | 270 | ); |
271 | | -CREATE UNIQUE INDEX pp_page_propname ON /*_*/page_props_tmp (pp_page,pp_propname); |
| 271 | +CREATE UNIQUE INDEX /*i*/pp_page_propname ON /*_*/page_props_tmp (pp_page,pp_propname); |
272 | 272 | |
273 | 273 | -------------------------------------------------------------------------------- |
274 | 274 | -- Populate the new tables using INSERT SELECT |
— | — | @@ -344,9 +344,9 @@ |
345 | 345 | si_title varchar(255) NOT NULL default '', |
346 | 346 | si_text mediumtext NOT NULL |
347 | 347 | ); |
348 | | -CREATE UNIQUE INDEX si_page ON /*_*/searchindex (si_page); |
349 | | -CREATE INDEX si_title ON /*_*/searchindex (si_title); |
350 | | -CREATE INDEX si_text ON /*_*/searchindex (si_text); |
| 348 | +CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex (si_page); |
| 349 | +CREATE INDEX /*i*/si_title ON /*_*/searchindex (si_title); |
| 350 | +CREATE INDEX /*i*/si_text ON /*_*/searchindex (si_text); |
351 | 351 | |
352 | 352 | DROP TABLE IF EXISTS /*_*/transcache; |
353 | 353 | CREATE TABLE /*_*/transcache ( |
— | — | @@ -354,14 +354,14 @@ |
355 | 355 | tc_contents text, |
356 | 356 | tc_time int NOT NULL |
357 | 357 | ) /*$wgDBTableOptions*/; |
358 | | -CREATE UNIQUE INDEX tc_url_idx ON /*_*/transcache (tc_url); |
| 358 | +CREATE UNIQUE INDEX /*i*/tc_url_idx ON /*_*/transcache (tc_url); |
359 | 359 | |
360 | 360 | DROP TABLE IF EXISTS /*_*/querycache_info; |
361 | 361 | CREATE TABLE /*_*/querycache_info ( |
362 | 362 | qci_type varbinary(32) NOT NULL default '', |
363 | 363 | qci_timestamp binary(14) NOT NULL default '19700101000000' |
364 | 364 | ) /*$wgDBTableOptions*/; |
365 | | -CREATE UNIQUE INDEX qci_type ON /*_*/querycache_info (qci_type); |
| 365 | +CREATE UNIQUE INDEX /*i*/qci_type ON /*_*/querycache_info (qci_type); |
366 | 366 | |
367 | 367 | -------------------------------------------------------------------------------- |
368 | 368 | -- Empty some cache tables to make the update faster |
— | — | @@ -375,43 +375,43 @@ |
376 | 376 | -- Add indexes to tables with no unique indexes |
377 | 377 | -------------------------------------------------------------------------------- |
378 | 378 | |
379 | | -CREATE INDEX un_user_id ON /*_*/user_newtalk (user_id); |
380 | | -CREATE INDEX un_user_ip ON /*_*/user_newtalk (user_ip); |
381 | | -CREATE INDEX name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp); |
382 | | -CREATE INDEX ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp); |
383 | | -CREATE INDEX el_from ON /*_*/externallinks (el_from, el_to(40)); |
384 | | -CREATE INDEX el_to ON /*_*/externallinks (el_to(60), el_from); |
385 | | -CREATE INDEX el_index ON /*_*/externallinks (el_index(60)); |
386 | | -CREATE INDEX img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); |
387 | | -CREATE INDEX img_size ON /*_*/image (img_size); |
388 | | -CREATE INDEX img_timestamp ON /*_*/image (img_timestamp); |
389 | | -CREATE INDEX img_sha1 ON /*_*/image (img_sha1); |
390 | | -CREATE INDEX oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); |
391 | | -CREATE INDEX oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); |
392 | | -CREATE INDEX oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14)); |
393 | | -CREATE INDEX oi_sha1 ON /*_*/oldimage (oi_sha1); |
394 | | -CREATE INDEX fa_name ON /*_*/filearchive (fa_name, fa_timestamp); |
395 | | -CREATE INDEX fa_group_key ON /*_*/filearchive (fa_storage_group, fa_storage_key); |
396 | | -CREATE INDEX fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); |
397 | | -CREATE INDEX fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp); |
398 | | -CREATE INDEX rc_timestamp ON /*_*/recentchanges (rc_timestamp); |
399 | | -CREATE INDEX rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title); |
400 | | -CREATE INDEX rc_cur_id ON /*_*/recentchanges (rc_cur_id); |
401 | | -CREATE INDEX new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp); |
402 | | -CREATE INDEX rc_ip ON /*_*/recentchanges (rc_ip); |
403 | | -CREATE INDEX rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text); |
404 | | -CREATE INDEX rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp); |
405 | | -CREATE INDEX qc_type_value ON /*_*/querycache (qc_type,qc_value); |
406 | | -CREATE INDEX oc_exptime ON /*_*/objectcache (exptime); |
407 | | -CREATE INDEX type_time ON /*_*/logging (log_type, log_timestamp); |
408 | | -CREATE INDEX user_time ON /*_*/logging (log_user, log_timestamp); |
409 | | -CREATE INDEX page_time ON /*_*/logging (log_namespace, log_title, log_timestamp); |
410 | | -CREATE INDEX times ON /*_*/logging (log_timestamp); |
411 | | -CREATE INDEX tb_page ON /*_*/trackbacks (tb_page); |
412 | | -CREATE INDEX job_cmd_namespace_title ON /*_*/job (job_cmd, job_namespace, job_title); |
413 | | -CREATE INDEX rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from); |
414 | | -CREATE INDEX qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value); |
415 | | -CREATE INDEX qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title); |
416 | | -CREATE INDEX qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo); |
| 379 | +CREATE INDEX /*i*/un_user_id ON /*_*/user_newtalk (user_id); |
| 380 | +CREATE INDEX /*i*/un_user_ip ON /*_*/user_newtalk (user_ip); |
| 381 | +CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp); |
| 382 | +CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp); |
| 383 | +CREATE INDEX /*i*/el_from ON /*_*/externallinks (el_from, el_to(40)); |
| 384 | +CREATE INDEX /*i*/el_to ON /*_*/externallinks (el_to(60), el_from); |
| 385 | +CREATE INDEX /*i*/el_index ON /*_*/externallinks (el_index(60)); |
| 386 | +CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); |
| 387 | +CREATE INDEX /*i*/img_size ON /*_*/image (img_size); |
| 388 | +CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp); |
| 389 | +CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1); |
| 390 | +CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); |
| 391 | +CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); |
| 392 | +CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14)); |
| 393 | +CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1); |
| 394 | +CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp); |
| 395 | +CREATE INDEX /*i*/fa_group_key ON /*_*/filearchive (fa_storage_group, fa_storage_key); |
| 396 | +CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); |
| 397 | +CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp); |
| 398 | +CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp); |
| 399 | +CREATE INDEX /*i*/rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title); |
| 400 | +CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id); |
| 401 | +CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp); |
| 402 | +CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip); |
| 403 | +CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text); |
| 404 | +CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp); |
| 405 | +CREATE INDEX /*i*/qc_type_value ON /*_*/querycache (qc_type,qc_value); |
| 406 | +CREATE INDEX /*i*/oc_exptime ON /*_*/objectcache (exptime); |
| 407 | +CREATE INDEX /*i*/type_time ON /*_*/logging (log_type, log_timestamp); |
| 408 | +CREATE INDEX /*i*/user_time ON /*_*/logging (log_user, log_timestamp); |
| 409 | +CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_timestamp); |
| 410 | +CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp); |
| 411 | +CREATE INDEX /*i*/tb_page ON /*_*/trackbacks (tb_page); |
| 412 | +CREATE INDEX /*i*/job_cmd_namespace_title ON /*_*/job (job_cmd, job_namespace, job_title); |
| 413 | +CREATE INDEX /*i*/rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from); |
| 414 | +CREATE INDEX /*i*/qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value); |
| 415 | +CREATE INDEX /*i*/qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title); |
| 416 | +CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo); |
417 | 417 | |
418 | 418 | INSERT INTO /*_*/updatelog VALUES ('initial_indexes'); |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -129,8 +129,8 @@ |
130 | 130 | user_editcount int |
131 | 131 | ) /*$wgDBTableOptions*/; |
132 | 132 | |
133 | | -CREATE UNIQUE INDEX user_name ON /*_*/user (user_name); |
134 | | -CREATE INDEX user_email_token ON /*_*/user (user_email_token); |
| 133 | +CREATE UNIQUE INDEX /*i*/user_name ON /*_*/user (user_name); |
| 134 | +CREATE INDEX /*i*/user_email_token ON /*_*/user (user_email_token); |
135 | 135 | |
136 | 136 | |
137 | 137 | -- |
— | — | @@ -156,8 +156,8 @@ |
157 | 157 | ug_group varbinary(16) NOT NULL default '' |
158 | 158 | ) /*$wgDBTableOptions*/; |
159 | 159 | |
160 | | -CREATE UNIQUE INDEX ug_user_group ON /*_*/user_groups (ug_user,ug_group); |
161 | | -CREATE INDEX ug_group ON /*_*/user_groups (ug_group); |
| 160 | +CREATE UNIQUE INDEX /*i*/ug_user_group ON /*_*/user_groups (ug_user,ug_group); |
| 161 | +CREATE INDEX /*i*/ug_group ON /*_*/user_groups (ug_group); |
162 | 162 | |
163 | 163 | |
164 | 164 | -- Stores notifications of user talk page changes, for the display |
— | — | @@ -174,8 +174,8 @@ |
175 | 175 | ) /*$wgDBTableOptions*/; |
176 | 176 | |
177 | 177 | -- Indexes renamed for SQLite in 1.14 |
178 | | -CREATE INDEX un_user_id ON /*_*/user_newtalk (user_id); |
179 | | -CREATE INDEX un_user_ip ON /*_*/user_newtalk (user_ip); |
| 178 | +CREATE INDEX /*i*/un_user_id ON /*_*/user_newtalk (user_id); |
| 179 | +CREATE INDEX /*i*/un_user_ip ON /*_*/user_newtalk (user_ip); |
180 | 180 | |
181 | 181 | |
182 | 182 | -- |
— | — | @@ -229,9 +229,9 @@ |
230 | 230 | page_len int unsigned NOT NULL |
231 | 231 | ) /*$wgDBTableOptions*/; |
232 | 232 | |
233 | | -CREATE UNIQUE INDEX name_title ON /*_*/page (page_namespace,page_title); |
234 | | -CREATE INDEX page_random ON /*_*/page (page_random); |
235 | | -CREATE INDEX page_len ON /*_*/page (page_len); |
| 233 | +CREATE UNIQUE INDEX /*i*/name_title ON /*_*/page (page_namespace,page_title); |
| 234 | +CREATE INDEX /*i*/page_random ON /*_*/page (page_random); |
| 235 | +CREATE INDEX /*i*/page_len ON /*_*/page (page_len); |
236 | 236 | |
237 | 237 | |
238 | 238 | -- |
— | — | @@ -283,11 +283,11 @@ |
284 | 284 | ) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024; |
285 | 285 | -- In case tables are created as MyISAM, use row hints for MySQL <5.0 to avoid 4GB limit |
286 | 286 | |
287 | | -CREATE UNIQUE INDEX rev_page_id ON /*_*/revision (rev_page, rev_id); |
288 | | -CREATE INDEX rev_timestamp ON /*_*/revision (rev_timestamp); |
289 | | -CREATE INDEX page_timestamp ON /*_*/revision (rev_page,rev_timestamp); |
290 | | -CREATE INDEX user_timestamp ON /*_*/revision (rev_user,rev_timestamp); |
291 | | -CREATE INDEX usertext_timestamp ON /*_*/revision (rev_user_text,rev_timestamp); |
| 287 | +CREATE UNIQUE INDEX /*i*/rev_page_id ON /*_*/revision (rev_page, rev_id); |
| 288 | +CREATE INDEX /*i*/rev_timestamp ON /*_*/revision (rev_timestamp); |
| 289 | +CREATE INDEX /*i*/page_timestamp ON /*_*/revision (rev_page,rev_timestamp); |
| 290 | +CREATE INDEX /*i*/user_timestamp ON /*_*/revision (rev_user,rev_timestamp); |
| 291 | +CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision (rev_user_text,rev_timestamp); |
292 | 292 | |
293 | 293 | -- |
294 | 294 | -- Holds text of individual page revisions. |
— | — | @@ -388,8 +388,8 @@ |
389 | 389 | ar_parent_id int unsigned default NULL |
390 | 390 | ) /*$wgDBTableOptions*/; |
391 | 391 | |
392 | | -CREATE INDEX name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp); |
393 | | -CREATE INDEX ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp); |
| 392 | +CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp); |
| 393 | +CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp); |
394 | 394 | |
395 | 395 | |
396 | 396 | -- |
— | — | @@ -407,8 +407,8 @@ |
408 | 408 | pl_title varchar(255) binary NOT NULL default '' |
409 | 409 | ) /*$wgDBTableOptions*/; |
410 | 410 | |
411 | | -CREATE UNIQUE INDEX pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title); |
412 | | -CREATE INDEX pl_namespace_title ON /*_*/pagelinks (pl_namespace,pl_title,pl_from); |
| 411 | +CREATE UNIQUE INDEX /*i*/pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title); |
| 412 | +CREATE INDEX /*i*/pl_namespace_title ON /*_*/pagelinks (pl_namespace,pl_title,pl_from); |
413 | 413 | |
414 | 414 | |
415 | 415 | -- |
— | — | @@ -426,8 +426,8 @@ |
427 | 427 | tl_title varchar(255) binary NOT NULL default '' |
428 | 428 | ) /*$wgDBTableOptions*/; |
429 | 429 | |
430 | | -CREATE UNIQUE INDEX tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title); |
431 | | -CREATE INDEX tl_namespace_title ON /*_*/templatelinks (tl_namespace,tl_title,tl_from); |
| 430 | +CREATE UNIQUE INDEX /*i*/tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title); |
| 431 | +CREATE INDEX /*i*/tl_namespace_title ON /*_*/templatelinks (tl_namespace,tl_title,tl_from); |
432 | 432 | |
433 | 433 | |
434 | 434 | -- |
— | — | @@ -445,8 +445,8 @@ |
446 | 446 | il_to varchar(255) binary NOT NULL default '' |
447 | 447 | ) /*$wgDBTableOptions*/; |
448 | 448 | |
449 | | -CREATE UNIQUE INDEX il_from ON /*_*/imagelinks (il_from,il_to); |
450 | | -CREATE INDEX il_to ON /*_*/imagelinks (il_to,il_from); |
| 449 | +CREATE UNIQUE INDEX /*i*/il_from ON /*_*/imagelinks (il_from,il_to); |
| 450 | +CREATE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from); |
451 | 451 | |
452 | 452 | |
453 | 453 | -- |
— | — | @@ -477,13 +477,13 @@ |
478 | 478 | cl_timestamp timestamp NOT NULL |
479 | 479 | ) /*$wgDBTableOptions*/; |
480 | 480 | |
481 | | -CREATE UNIQUE INDEX cl_from ON /*_*/categorylinks (cl_from,cl_to); |
| 481 | +CREATE UNIQUE INDEX /*i*/cl_from ON /*_*/categorylinks (cl_from,cl_to); |
482 | 482 | |
483 | 483 | -- We always sort within a given category... |
484 | | -CREATE INDEX cl_sortkey ON /*_*/categorylinks (cl_to,cl_sortkey,cl_from); |
| 484 | +CREATE INDEX /*i*/cl_sortkey ON /*_*/categorylinks (cl_to,cl_sortkey,cl_from); |
485 | 485 | |
486 | 486 | -- Not really used? |
487 | | -CREATE INDEX cl_timestamp ON /*_*/categorylinks (cl_to,cl_timestamp); |
| 487 | +CREATE INDEX /*i*/cl_timestamp ON /*_*/categorylinks (cl_to,cl_timestamp); |
488 | 488 | |
489 | 489 | |
490 | 490 | -- |
— | — | @@ -513,10 +513,10 @@ |
514 | 514 | cat_hidden tinyint unsigned NOT NULL default 0 |
515 | 515 | ) /*$wgDBTableOptions*/; |
516 | 516 | |
517 | | -CREATE UNIQUE INDEX cat_title ON /*_*/category (cat_title); |
| 517 | +CREATE UNIQUE INDEX /*i*/cat_title ON /*_*/category (cat_title); |
518 | 518 | |
519 | 519 | -- For Special:Mostlinkedcategories |
520 | | -CREATE INDEX cat_pages ON /*_*/category (cat_pages); |
| 520 | +CREATE INDEX /*i*/cat_pages ON /*_*/category (cat_pages); |
521 | 521 | |
522 | 522 | |
523 | 523 | -- |
— | — | @@ -543,9 +543,9 @@ |
544 | 544 | el_index blob NOT NULL |
545 | 545 | ) /*$wgDBTableOptions*/; |
546 | 546 | |
547 | | -CREATE INDEX el_from ON /*_*/externallinks (el_from, el_to(40)); |
548 | | -CREATE INDEX el_to ON /*_*/externallinks (el_to(60), el_from); |
549 | | -CREATE INDEX el_index ON /*_*/externallinks (el_index(60)); |
| 547 | +CREATE INDEX /*i*/el_from ON /*_*/externallinks (el_from, el_to(40)); |
| 548 | +CREATE INDEX /*i*/el_to ON /*_*/externallinks (el_to(60), el_from); |
| 549 | +CREATE INDEX /*i*/el_index ON /*_*/externallinks (el_index(60)); |
550 | 550 | |
551 | 551 | |
552 | 552 | -- |
— | — | @@ -562,8 +562,8 @@ |
563 | 563 | ll_title varchar(255) binary NOT NULL default '' |
564 | 564 | ) /*$wgDBTableOptions*/; |
565 | 565 | |
566 | | -CREATE UNIQUE INDEX ll_from ON /*_*/langlinks (ll_from, ll_lang); |
567 | | -CREATE INDEX ll_lang_title ON /*_*/langlinks (ll_lang, ll_title); |
| 566 | +CREATE UNIQUE INDEX /*i*/ll_from ON /*_*/langlinks (ll_from, ll_lang); |
| 567 | +CREATE INDEX /*i*/ll_lang_title ON /*_*/langlinks (ll_lang, ll_title); |
568 | 568 | |
569 | 569 | |
570 | 570 | -- |
— | — | @@ -604,7 +604,7 @@ |
605 | 605 | ) /*$wgDBTableOptions*/; |
606 | 606 | |
607 | 607 | -- Pointless index to assuage developer superstitions |
608 | | -CREATE UNIQUE INDEX ss_row_id ON /*_*/site_stats (ss_row_id); |
| 608 | +CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats (ss_row_id); |
609 | 609 | |
610 | 610 | |
611 | 611 | -- |
— | — | @@ -682,12 +682,12 @@ |
683 | 683 | |
684 | 684 | -- Unique index to support "user already blocked" messages |
685 | 685 | -- Any new options which prevent collisions should be included |
686 | | -CREATE UNIQUE INDEX ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only); |
| 686 | +CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only); |
687 | 687 | |
688 | | -CREATE INDEX ipb_user ON /*_*/ipblocks (ipb_user); |
689 | | -CREATE INDEX ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8)); |
690 | | -CREATE INDEX ipb_timestamp ON /*_*/ipblocks (ipb_timestamp); |
691 | | -CREATE INDEX ipb_expiry ON /*_*/ipblocks (ipb_expiry); |
| 688 | +CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks (ipb_user); |
| 689 | +CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8)); |
| 690 | +CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks (ipb_timestamp); |
| 691 | +CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry); |
692 | 692 | |
693 | 693 | |
694 | 694 | -- |
— | — | @@ -740,13 +740,13 @@ |
741 | 741 | img_sha1 varbinary(32) NOT NULL default '' |
742 | 742 | ) /*$wgDBTableOptions*/; |
743 | 743 | |
744 | | -CREATE INDEX img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); |
| 744 | +CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); |
745 | 745 | -- Used by Special:Imagelist for sort-by-size |
746 | | -CREATE INDEX img_size ON /*_*/image (img_size); |
| 746 | +CREATE INDEX /*i*/img_size ON /*_*/image (img_size); |
747 | 747 | -- Used by Special:Newimages and Special:Imagelist |
748 | | -CREATE INDEX img_timestamp ON /*_*/image (img_timestamp); |
| 748 | +CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp); |
749 | 749 | -- Used in API and duplicate search |
750 | | -CREATE INDEX img_sha1 ON /*_*/image (img_sha1); |
| 750 | +CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1); |
751 | 751 | |
752 | 752 | |
753 | 753 | -- |
— | — | @@ -780,11 +780,11 @@ |
781 | 781 | oi_sha1 varbinary(32) NOT NULL default '' |
782 | 782 | ) /*$wgDBTableOptions*/; |
783 | 783 | |
784 | | -CREATE INDEX oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); |
785 | | -CREATE INDEX oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); |
| 784 | +CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); |
| 785 | +CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); |
786 | 786 | -- oi_archive_name truncated to 14 to avoid key length overflow |
787 | | -CREATE INDEX oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14)); |
788 | | -CREATE INDEX oi_sha1 ON /*_*/oldimage (oi_sha1); |
| 787 | +CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14)); |
| 788 | +CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1); |
789 | 789 | |
790 | 790 | |
791 | 791 | -- |
— | — | @@ -836,13 +836,13 @@ |
837 | 837 | ) /*$wgDBTableOptions*/; |
838 | 838 | |
839 | 839 | -- pick out by image name |
840 | | -CREATE INDEX fa_name ON /*_*/filearchive (fa_name, fa_timestamp); |
| 840 | +CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp); |
841 | 841 | -- pick out dupe files |
842 | | -CREATE INDEX fa_group_key ON /*_*/filearchive (fa_storage_group, fa_storage_key); |
| 842 | +CREATE INDEX /*i*/fa_group_key ON /*_*/filearchive (fa_storage_group, fa_storage_key); |
843 | 843 | -- sort by deletion time |
844 | | -CREATE INDEX fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); |
| 844 | +CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); |
845 | 845 | -- sort by uploader |
846 | | -CREATE INDEX fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp); |
| 846 | +CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp); |
847 | 847 | |
848 | 848 | |
849 | 849 | -- |
— | — | @@ -918,13 +918,13 @@ |
919 | 919 | rc_params blob NULL |
920 | 920 | ) /*$wgDBTableOptions*/; |
921 | 921 | |
922 | | -CREATE INDEX rc_timestamp ON /*_*/recentchanges (rc_timestamp); |
923 | | -CREATE INDEX rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title); |
924 | | -CREATE INDEX rc_cur_id ON /*_*/recentchanges (rc_cur_id); |
925 | | -CREATE INDEX new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp); |
926 | | -CREATE INDEX rc_ip ON /*_*/recentchanges (rc_ip); |
927 | | -CREATE INDEX rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text); |
928 | | -CREATE INDEX rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp); |
| 922 | +CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp); |
| 923 | +CREATE INDEX /*i*/rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title); |
| 924 | +CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id); |
| 925 | +CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp); |
| 926 | +CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip); |
| 927 | +CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text); |
| 928 | +CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp); |
929 | 929 | |
930 | 930 | |
931 | 931 | CREATE TABLE /*_*/watchlist ( |
— | — | @@ -943,8 +943,8 @@ |
944 | 944 | |
945 | 945 | ) /*$wgDBTableOptions*/; |
946 | 946 | |
947 | | -CREATE UNIQUE INDEX wl_user_namespace_title ON /*_*/watchlist (wl_user, wl_namespace, wl_title); |
948 | | -CREATE INDEX namespace_title ON /*_*/watchlist (wl_namespace, wl_title); |
| 947 | +CREATE UNIQUE INDEX /*i*/wl_user_namespace_title ON /*_*/watchlist (wl_user, wl_namespace, wl_title); |
| 948 | +CREATE INDEX /*i*/namespace_title ON /*_*/watchlist (wl_namespace, wl_title); |
949 | 949 | |
950 | 950 | |
951 | 951 | -- |
— | — | @@ -969,7 +969,7 @@ |
970 | 970 | math_mathml text |
971 | 971 | ) /*$wgDBTableOptions*/; |
972 | 972 | |
973 | | -CREATE UNIQUE INDEX math_inputhash ON /*_*/math (math_inputhash); |
| 973 | +CREATE UNIQUE INDEX /*i*/math_inputhash ON /*_*/math (math_inputhash); |
974 | 974 | |
975 | 975 | |
976 | 976 | -- |
— | — | @@ -991,9 +991,9 @@ |
992 | 992 | si_text mediumtext NOT NULL |
993 | 993 | ) ENGINE=MyISAM; |
994 | 994 | |
995 | | -CREATE UNIQUE INDEX si_page ON /*_*/searchindex (si_page); |
996 | | -CREATE FULLTEXT INDEX si_title ON /*_*/searchindex (si_title); |
997 | | -CREATE FULLTEXT INDEX si_text ON /*_*/searchindex (si_text); |
| 995 | +CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex (si_page); |
| 996 | +CREATE FULLTEXT INDEX /*i*/si_title ON /*_*/searchindex (si_title); |
| 997 | +CREATE FULLTEXT INDEX /*i*/si_text ON /*_*/searchindex (si_text); |
998 | 998 | |
999 | 999 | |
1000 | 1000 | -- |
— | — | @@ -1016,7 +1016,7 @@ |
1017 | 1017 | iw_trans tinyint NOT NULL default 0 |
1018 | 1018 | ) /*$wgDBTableOptions*/; |
1019 | 1019 | |
1020 | | -CREATE UNIQUE INDEX iw_prefix ON /*_*/interwiki (iw_prefix); |
| 1020 | +CREATE UNIQUE INDEX /*i*/iw_prefix ON /*_*/interwiki (iw_prefix); |
1021 | 1021 | |
1022 | 1022 | |
1023 | 1023 | -- |
— | — | @@ -1034,7 +1034,7 @@ |
1035 | 1035 | qc_title varchar(255) binary NOT NULL default '' |
1036 | 1036 | ) /*$wgDBTableOptions*/; |
1037 | 1037 | |
1038 | | -CREATE INDEX qc_type_value ON /*_*/querycache (qc_type,qc_value); |
| 1038 | +CREATE INDEX /*i*/qc_type_value ON /*_*/querycache (qc_type,qc_value); |
1039 | 1039 | |
1040 | 1040 | |
1041 | 1041 | -- |
— | — | @@ -1045,7 +1045,7 @@ |
1046 | 1046 | value mediumblob, |
1047 | 1047 | exptime datetime |
1048 | 1048 | ) /*$wgDBTableOptions*/; |
1049 | | -CREATE INDEX oc_exptime ON /*_*/objectcache (exptime); |
| 1049 | +CREATE INDEX /*i*/oc_exptime ON /*_*/objectcache (exptime); |
1050 | 1050 | |
1051 | 1051 | |
1052 | 1052 | -- |
— | — | @@ -1057,7 +1057,7 @@ |
1058 | 1058 | tc_time int NOT NULL |
1059 | 1059 | ) /*$wgDBTableOptions*/; |
1060 | 1060 | |
1061 | | -CREATE UNIQUE INDEX tc_url_idx ON /*_*/transcache (tc_url); |
| 1061 | +CREATE UNIQUE INDEX /*i*/tc_url_idx ON /*_*/transcache (tc_url); |
1062 | 1062 | |
1063 | 1063 | |
1064 | 1064 | CREATE TABLE /*_*/logging ( |
— | — | @@ -1091,10 +1091,10 @@ |
1092 | 1092 | log_deleted tinyint unsigned NOT NULL default 0 |
1093 | 1093 | ) /*$wgDBTableOptions*/; |
1094 | 1094 | |
1095 | | -CREATE INDEX type_time ON /*_*/logging (log_type, log_timestamp); |
1096 | | -CREATE INDEX user_time ON /*_*/logging (log_user, log_timestamp); |
1097 | | -CREATE INDEX page_time ON /*_*/logging (log_namespace, log_title, log_timestamp); |
1098 | | -CREATE INDEX times ON /*_*/logging (log_timestamp); |
| 1095 | +CREATE INDEX /*i*/type_time ON /*_*/logging (log_type, log_timestamp); |
| 1096 | +CREATE INDEX /*i*/user_time ON /*_*/logging (log_user, log_timestamp); |
| 1097 | +CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_timestamp); |
| 1098 | +CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp); |
1099 | 1099 | |
1100 | 1100 | |
1101 | 1101 | CREATE TABLE /*_*/trackbacks ( |
— | — | @@ -1105,7 +1105,7 @@ |
1106 | 1106 | tb_ex text, |
1107 | 1107 | tb_name varchar(255) |
1108 | 1108 | ) /*$wgDBTableOptions*/; |
1109 | | -CREATE INDEX tb_page ON /*_*/trackbacks (tb_page); |
| 1109 | +CREATE INDEX /*i*/tb_page ON /*_*/trackbacks (tb_page); |
1110 | 1110 | |
1111 | 1111 | |
1112 | 1112 | -- Jobs performed by parallel apache threads or a command-line daemon |
— | — | @@ -1126,7 +1126,7 @@ |
1127 | 1127 | job_params blob NOT NULL |
1128 | 1128 | ) /*$wgDBTableOptions*/; |
1129 | 1129 | |
1130 | | -CREATE INDEX job_cmd_namespace_title ON /*_*/job (job_cmd, job_namespace, job_title); |
| 1130 | +CREATE INDEX /*i*/job_cmd_namespace_title ON /*_*/job (job_cmd, job_namespace, job_title); |
1131 | 1131 | |
1132 | 1132 | |
1133 | 1133 | -- Details of updates to cached special pages |
— | — | @@ -1139,7 +1139,7 @@ |
1140 | 1140 | qci_timestamp binary(14) NOT NULL default '19700101000000' |
1141 | 1141 | ) /*$wgDBTableOptions*/; |
1142 | 1142 | |
1143 | | -CREATE UNIQUE INDEX qci_type ON /*_*/querycache_info (qci_type); |
| 1143 | +CREATE UNIQUE INDEX /*i*/qci_type ON /*_*/querycache_info (qci_type); |
1144 | 1144 | |
1145 | 1145 | |
1146 | 1146 | -- For each redirect, this table contains exactly one row defining its target |
— | — | @@ -1155,7 +1155,7 @@ |
1156 | 1156 | rd_title varchar(255) binary NOT NULL default '' |
1157 | 1157 | ) /*$wgDBTableOptions*/; |
1158 | 1158 | |
1159 | | -CREATE INDEX rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from); |
| 1159 | +CREATE INDEX /*i*/rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from); |
1160 | 1160 | |
1161 | 1161 | |
1162 | 1162 | -- Used for caching expensive grouped queries that need two links (for example double-redirects) |
— | — | @@ -1175,9 +1175,9 @@ |
1176 | 1176 | qcc_titletwo varchar(255) binary NOT NULL default '' |
1177 | 1177 | ) /*$wgDBTableOptions*/; |
1178 | 1178 | |
1179 | | -CREATE INDEX qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value); |
1180 | | -CREATE INDEX qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title); |
1181 | | -CREATE INDEX qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo); |
| 1179 | +CREATE INDEX /*i*/qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value); |
| 1180 | +CREATE INDEX /*i*/qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title); |
| 1181 | +CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo); |
1182 | 1182 | |
1183 | 1183 | |
1184 | 1184 | -- Used for storing page restrictions (i.e. protection levels) |
— | — | @@ -1198,10 +1198,10 @@ |
1199 | 1199 | pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT |
1200 | 1200 | ) /*$wgDBTableOptions*/; |
1201 | 1201 | |
1202 | | -CREATE UNIQUE INDEX pr_pagetype ON /*_*/page_restrictions (pr_page,pr_type); |
1203 | | -CREATE UNIQUE INDEX pr_typelevel ON /*_*/page_restrictions (pr_type,pr_level); |
1204 | | -CREATE UNIQUE INDEX pr_level ON /*_*/page_restrictions (pr_level); |
1205 | | -CREATE UNIQUE INDEX pr_cascade ON /*_*/page_restrictions (pr_cascade); |
| 1202 | +CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions (pr_page,pr_type); |
| 1203 | +CREATE UNIQUE INDEX /*i*/pr_typelevel ON /*_*/page_restrictions (pr_type,pr_level); |
| 1204 | +CREATE UNIQUE INDEX /*i*/pr_level ON /*_*/page_restrictions (pr_level); |
| 1205 | +CREATE UNIQUE INDEX /*i*/pr_cascade ON /*_*/page_restrictions (pr_cascade); |
1206 | 1206 | |
1207 | 1207 | |
1208 | 1208 | -- Protected titles - nonexistent pages that have been protected |
— | — | @@ -1215,8 +1215,8 @@ |
1216 | 1216 | pt_create_perm varbinary(60) NOT NULL |
1217 | 1217 | ) /*$wgDBTableOptions*/; |
1218 | 1218 | |
1219 | | -CREATE UNIQUE INDEX pt_namespace_title ON /*_*/protected_titles (pt_namespace,pt_title); |
1220 | | -CREATE INDEX pt_timestamp ON /*_*/protected_titles (pt_timestamp); |
| 1219 | +CREATE UNIQUE INDEX /*i*/pt_namespace_title ON /*_*/protected_titles (pt_namespace,pt_title); |
| 1220 | +CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp); |
1221 | 1221 | |
1222 | 1222 | |
1223 | 1223 | -- Name/value pairs indexed by page_id |
— | — | @@ -1226,7 +1226,7 @@ |
1227 | 1227 | pp_value blob NOT NULL |
1228 | 1228 | ) /*$wgDBTableOptions*/; |
1229 | 1229 | |
1230 | | -CREATE UNIQUE INDEX pp_page_propname ON /*_*/page_props (pp_page,pp_propname); |
| 1230 | +CREATE UNIQUE INDEX /*i*/pp_page_propname ON /*_*/page_props (pp_page,pp_propname); |
1231 | 1231 | |
1232 | 1232 | |
1233 | 1233 | -- A table to log updates, one text key row per update. |
Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -698,7 +698,7 @@ |
699 | 699 | return NULL; |
700 | 700 | } |
701 | 701 | while ( $row = $this->fetchObject( $res ) ) { |
702 | | - if ( $row->indexname == $index ) { |
| 702 | + if ( $row->indexname == $this->indexName( $index ) ) { |
703 | 703 | return $row; |
704 | 704 | } |
705 | 705 | } |
— | — | @@ -707,7 +707,9 @@ |
708 | 708 | |
709 | 709 | function indexUnique ($table, $index, $fname = 'Database::indexUnique' ) { |
710 | 710 | $sql = "SELECT indexname FROM pg_indexes WHERE tablename='{$table}'". |
711 | | - " AND indexdef LIKE 'CREATE UNIQUE%({$index})'"; |
| 711 | + " AND indexdef LIKE 'CREATE UNIQUE%(" . |
| 712 | + $this->strencode( $this->indexName( $index ) ) . |
| 713 | + ")'"; |
712 | 714 | $res = $this->query( $sql, $fname ); |
713 | 715 | if ( !$res ) |
714 | 716 | return NULL; |
Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -1191,6 +1191,7 @@ |
1192 | 1192 | # SHOW INDEX should work for 3.x and up: |
1193 | 1193 | # http://dev.mysql.com/doc/mysql/en/SHOW_INDEX.html |
1194 | 1194 | $table = $this->tableName( $table ); |
| 1195 | + $index = $this->indexName( $index ); |
1195 | 1196 | $sql = 'SHOW INDEX FROM '.$table; |
1196 | 1197 | $res = $this->query( $sql, $fname ); |
1197 | 1198 | if ( !$res ) { |
— | — | @@ -1574,6 +1575,18 @@ |
1575 | 1576 | } |
1576 | 1577 | |
1577 | 1578 | /** |
| 1579 | + * Get the name of an index in a given table |
| 1580 | + */ |
| 1581 | + function indexName( $index ) { |
| 1582 | + // Backwards-compatibility hack |
| 1583 | + if ( $index == 'ar_usertext_timestamp' ) { |
| 1584 | + return 'usertext_timestamp'; |
| 1585 | + } else { |
| 1586 | + return $index; |
| 1587 | + } |
| 1588 | + } |
| 1589 | + |
| 1590 | + /** |
1578 | 1591 | * Wrapper for addslashes() |
1579 | 1592 | * @param $s String: to be slashed. |
1580 | 1593 | * @return String: slashed string. |
— | — | @@ -1621,7 +1634,7 @@ |
1622 | 1635 | * PostgreSQL doesn't have them and returns "" |
1623 | 1636 | */ |
1624 | 1637 | function useIndexClause( $index ) { |
1625 | | - return "FORCE INDEX ($index)"; |
| 1638 | + return "FORCE INDEX (" . $this->indexName( $index ) . ")"; |
1626 | 1639 | } |
1627 | 1640 | |
1628 | 1641 | /** |
— | — | @@ -2258,8 +2271,12 @@ |
2259 | 2272 | } |
2260 | 2273 | |
2261 | 2274 | // Table prefixes |
2262 | | - $ins = preg_replace_callback( '/\/\*(?:\$wgDBprefix|_)\*\/([a-zA-Z_0-9]*)/', |
2263 | | - array( &$this, 'tableNameCallback' ), $ins ); |
| 2275 | + $ins = preg_replace_callback( '!/\*(?:\$wgDBprefix|_)\*/([a-zA-Z_0-9]*)!', |
| 2276 | + array( $this, 'tableNameCallback' ), $ins ); |
| 2277 | + |
| 2278 | + // Index names |
| 2279 | + $ins = preg_replace_callback( '!/\*i\*/([a-zA-Z_0-9]*)!', |
| 2280 | + array( $this, 'indexNameCallback' ), $ins ); |
2264 | 2281 | return $ins; |
2265 | 2282 | } |
2266 | 2283 | |
— | — | @@ -2271,6 +2288,13 @@ |
2272 | 2289 | return $this->tableName( $matches[1] ); |
2273 | 2290 | } |
2274 | 2291 | |
| 2292 | + /** |
| 2293 | + * Index name callback |
| 2294 | + */ |
| 2295 | + protected function indexNameCallback( $matches ) { |
| 2296 | + return $this->indexName( $matches[1] ); |
| 2297 | + } |
| 2298 | + |
2275 | 2299 | /* |
2276 | 2300 | * Build a concatenation list to feed into a SQL query |
2277 | 2301 | */ |
Index: trunk/phase3/includes/db/DatabaseSqlite.php |
— | — | @@ -101,11 +101,11 @@ |
102 | 102 | return $res; |
103 | 103 | } |
104 | 104 | |
105 | | - function freeResult(&$res) { |
| 105 | + function freeResult($res) { |
106 | 106 | if ($res instanceof ResultWrapper) $res->result = NULL; else $res = NULL; |
107 | 107 | } |
108 | 108 | |
109 | | - function fetchObject(&$res) { |
| 109 | + function fetchObject($res) { |
110 | 110 | if ($res instanceof ResultWrapper) $r =& $res->result; else $r =& $res; |
111 | 111 | $cur = current($r); |
112 | 112 | if (is_array($cur)) { |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | | - function fetchRow(&$res) { |
| 121 | + function fetchRow($res) { |
122 | 122 | if ($res instanceof ResultWrapper) $r =& $res->result; else $r =& $res; |
123 | 123 | $cur = current($r); |
124 | 124 | if (is_array($cur)) { |
— | — | @@ -130,17 +130,17 @@ |
131 | 131 | /** |
132 | 132 | * The PDO::Statement class implements the array interface so count() will work |
133 | 133 | */ |
134 | | - function numRows(&$res) { |
| 134 | + function numRows($res) { |
135 | 135 | $r = $res instanceof ResultWrapper ? $res->result : $res; |
136 | 136 | return count($r); |
137 | 137 | } |
138 | 138 | |
139 | | - function numFields(&$res) { |
| 139 | + function numFields($res) { |
140 | 140 | $r = $res instanceof ResultWrapper ? $res->result : $res; |
141 | 141 | return is_array($r) ? count($r[0]) : 0; |
142 | 142 | } |
143 | 143 | |
144 | | - function fieldName(&$res,$n) { |
| 144 | + function fieldName($res,$n) { |
145 | 145 | $r = $res instanceof ResultWrapper ? $res->result : $res; |
146 | 146 | if (is_array($r)) { |
147 | 147 | $keys = array_keys($r[0]); |
— | — | @@ -157,13 +157,20 @@ |
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
| 161 | + * Index names have DB scope |
| 162 | + */ |
| 163 | + function indexName( $index ) { |
| 164 | + return $index; |
| 165 | + } |
| 166 | + |
| 167 | + /** |
161 | 168 | * This must be called after nextSequenceVal |
162 | 169 | */ |
163 | 170 | function insertId() { |
164 | 171 | return $this->mConn->lastInsertId(); |
165 | 172 | } |
166 | 173 | |
167 | | - function dataSeek(&$res,$row) { |
| 174 | + function dataSeek($res,$row) { |
168 | 175 | if ($res instanceof ResultWrapper) $r =& $res->result; else $r =& $res; |
169 | 176 | reset($r); |
170 | 177 | if ($row > 0) for ($i = 0; $i < $row; $i++) next($r); |
— | — | @@ -194,7 +201,7 @@ |
195 | 202 | * - if errors are explicitly ignored, returns NULL on failure |
196 | 203 | */ |
197 | 204 | function indexInfo($table, $index, $fname = 'Database::indexExists') { |
198 | | - $sql = 'PRAGMA index_info(' . $this->addQuotes( $index ) . ')'; |
| 205 | + $sql = 'PRAGMA index_info(' . $this->addQuotes( $this->indexName( $index ) ) . ')'; |
199 | 206 | $res = $this->query( $sql, $fname ); |
200 | 207 | if ( !$res ) { |
201 | 208 | return null; |
— | — | @@ -213,7 +220,7 @@ |
214 | 221 | $row = $this->selectRow( 'sqlite_master', '*', |
215 | 222 | array( |
216 | 223 | 'type' => 'index', |
217 | | - 'name' => $index, |
| 224 | + 'name' => $this->indexName( $index ), |
218 | 225 | ), $fname ); |
219 | 226 | if ( !$row || !isset( $row->sql ) ) { |
220 | 227 | return null; |
— | — | @@ -314,7 +321,7 @@ |
315 | 322 | /** |
316 | 323 | * Query whether a given column exists in the mediawiki schema |
317 | 324 | */ |
318 | | - function fieldExists($table, $field) { |
| 325 | + function fieldExists($table, $field, $fname = '') { |
319 | 326 | $info = $this->fieldInfo( $table, $field ); |
320 | 327 | return (bool)$info; |
321 | 328 | } |
— | — | @@ -335,19 +342,19 @@ |
336 | 343 | return false; |
337 | 344 | } |
338 | 345 | |
339 | | - function begin() { |
| 346 | + function begin( $fname = '' ) { |
340 | 347 | if ($this->mTrxLevel == 1) $this->commit(); |
341 | 348 | $this->mConn->beginTransaction(); |
342 | 349 | $this->mTrxLevel = 1; |
343 | 350 | } |
344 | 351 | |
345 | | - function commit() { |
| 352 | + function commit( $fname = '' ) { |
346 | 353 | if ($this->mTrxLevel == 0) return; |
347 | 354 | $this->mConn->commit(); |
348 | 355 | $this->mTrxLevel = 0; |
349 | 356 | } |
350 | 357 | |
351 | | - function rollback() { |
| 358 | + function rollback( $fname = '' ) { |
352 | 359 | if ($this->mTrxLevel == 0) return; |
353 | 360 | $this->mConn->rollBack(); |
354 | 361 | $this->mTrxLevel = 0; |