Commit 58d1270a authored by drumm's avatar drumm

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

parent 72a19d00
...@@ -243,7 +243,8 @@ function system_install() { ...@@ -243,7 +243,8 @@ function system_install() {
vid int unsigned NOT NULL default 0, vid int unsigned NOT NULL default 0,
description varchar(255) NOT NULL default '', description varchar(255) NOT NULL default '',
list tinyint unsigned NOT NULL default 0, list tinyint unsigned NOT NULL default 0,
PRIMARY KEY (fid, vid) PRIMARY KEY (fid, vid),
KEY (vid)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {filter_formats} ( db_query("CREATE TABLE {filter_formats} (
...@@ -674,6 +675,7 @@ function system_install() { ...@@ -674,6 +675,7 @@ function system_install() {
list smallint_unsigned NOT NULL default 0, list smallint_unsigned NOT NULL default 0,
PRIMARY KEY (fid, vid) PRIMARY KEY (fid, vid)
)"); )");
db_query("CREATE INDEX file_revisions_vid_idx ON file_revisions(vid)");
db_query("CREATE TABLE {filter_formats} ( db_query("CREATE TABLE {filter_formats} (
format serial, format serial,
...@@ -3367,6 +3369,20 @@ function system_update_1011() { ...@@ -3367,6 +3369,20 @@ function system_update_1011() {
return $ret; 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" * @} End of "defgroup updates-4.7-to-x.x"
* The next series of updates should start at 2000. * The next series of updates should start at 2000.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment