#73045 by jhenry and davemicc. Add an index to {file_revisions} for faster queries.

5.x
Neil Drumm 2006-09-07 07:57:20 +00:00
parent 72a19d0063
commit 58d1270a7d
1 changed files with 17 additions and 1 deletions

View File

@ -243,7 +243,8 @@ function system_install() {
vid int unsigned NOT NULL default 0,
description varchar(255) NOT NULL default '',
list tinyint unsigned NOT NULL default 0,
PRIMARY KEY (fid, vid)
PRIMARY KEY (fid, vid),
KEY (vid)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {filter_formats} (
@ -674,6 +675,7 @@ function system_install() {
list smallint_unsigned NOT NULL default 0,
PRIMARY KEY (fid, vid)
)");
db_query("CREATE INDEX file_revisions_vid_idx ON file_revisions(vid)");
db_query("CREATE TABLE {filter_formats} (
format serial,
@ -3367,6 +3369,20 @@ function system_update_1011() {
return $ret;
}
function system_update_1012() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {file_revisions} ADD INDEX(vid)");
break;
case 'pgsql':
$ret[] = update_sql('CREATE INDEX {file_revisions}_vid_idx ON {file_revisions}(vid)');
break;
}
return $ret;
}
/**
* @} End of "defgroup updates-4.7-to-x.x"
* The next series of updates should start at 2000.