Commit 83e77b37 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#198461 by chx: use a simple subquery instead of iterating through all nodes...

#198461 by chx: use a simple subquery instead of iterating through all nodes and updating the term_node table one-by-one, which easily caused a timeout on sites with lots of term-node associations
parent 5d8cf1b8
......@@ -1628,11 +1628,7 @@ function system_update_6001() {
db_add_primary_key($ret, 'term_node', array('vid', 'tid', 'nid'));
db_add_index($ret, 'term_node', 'vid', array('vid'));
// Update all entries with the current revision number.
$nodes = db_query('SELECT nid, vid FROM {node}');
while ($node = db_fetch_object($nodes)) {
db_query('UPDATE {term_node} SET vid = %d WHERE nid = %d', $node->vid, $node->nid);
}
db_query('UPDATE {term_node} t SET vid = (SELECT vid FROM {node} n WHERE t.nid = n.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