Commit eb2fb414 authored by Dries's avatar Dries
Browse files

- Patch by Matt and chx: improved performance of taxonomy queries. When many

  terms are matched, the query would become very slow.
parent a7fa9552
......@@ -653,7 +653,8 @@ CREATE TABLE term_node (
nid int(10) unsigned NOT NULL default '0',
tid int(10) unsigned NOT NULL default '0',
KEY nid (nid),
KEY tid (tid)
KEY tid (tid),
PRIMARY KEY (tid,nid)
) TYPE=MyISAM;
--
......
......@@ -649,7 +649,8 @@ CREATE INDEX term_hierarchy_parent_idx ON term_hierarchy(parent);
CREATE TABLE term_node (
nid integer NOT NULL default '0',
tid integer NOT NULL default '0'
tid integer NOT NULL default '0',
PRIMARY KEY (tid,nid)
);
CREATE INDEX term_node_nid_idx ON term_node(nid);
CREATE INDEX term_node_tid_idx ON term_node(tid);
......
......@@ -103,7 +103,8 @@
"2005-02-11" => "update_124",
"2005-02-23" => "update_125",
"2005-03-03" => "update_126",
"2005-03-18" => "update_127"
"2005-03-18" => "update_127",
"2005-03-21" => "update_128"
);
function update_32() {
......@@ -2336,4 +2337,17 @@ function update_sql($sql) {
}
}
function update_128() {
$ret = array();
if ($GLOBALS['db_type'] == 'mysql') {
$ret[] = update_sql('ALTER TABLE {term_node} ADD PRIMARY KEY (tid,nid)');
}
elseif ($GLOBALS['db_type'] == 'pgsql') {
$ret[] = update_sql('ALTER TABLE {term_node} ADD PRIMARY KEY (tid,nid)');
}
return $ret;
}
?>
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