Commit 9f91274a authored by Dries's avatar Dries
Browse files

- Patch #118712 by mindless: add index on comment.status.

parent 0340d4d5
......@@ -263,7 +263,8 @@ function system_install() {
mail varchar(64) default NULL,
homepage varchar(255) default NULL,
PRIMARY KEY (cid),
KEY lid (nid)
KEY lid (nid),
KEY status (status)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {node_comment_statistics} (
......@@ -739,6 +740,7 @@ function system_install() {
PRIMARY KEY (cid)
)");
db_query("CREATE INDEX {comments}_nid_idx ON {comments} (nid)");
db_query("CREATE INDEX {comments}_status_idx ON {comments} (status)");
db_query("CREATE TABLE {node_comment_statistics} (
nid serial CHECK (nid >= 0),
......@@ -3595,6 +3597,24 @@ function system_update_2002() {
return $ret;
}
/**
* Add index on comments status column.
*/
function system_update_2003() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql('ALTER TABLE {comments} ADD KEY status (status)');
break;
case 'pgsql':
$ret[] = update_sql("CREATE INDEX {comments}_status_idx ON {comments} (status)");
break;
}
return $ret;
}
/**
* @} End of "defgroup updates-5.0-to-x.x"
* The next series of updates should start at 3000.
......
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