There is a severe performance degradation due to a wrong join.
This query in gsitemap_output_chunk()
$result = db_query(db_rewrite_sql(sprintf("SELECT DISTINCT(n.nid), n.type, n.status, n.promote, n.changed, g.previously_changed, g.priority_override FROM {node} n LEFT JOIN {gsitemap} g ON n.nid=g.nid LEFT JOIN {url_alias} u ON src=CONCAT('node/',n.nid) WHERE n.status > 0 AND (g.priority_override >=0 OR g.priority_override IS NULL) AND n.type NOT IN (" . $excludes . ") AND n.nid >= %d AND n.nid < %d", $range->low, $range->high), 'n'));
Does not use any of the columns in the u.* table, and it is a LEFT JOIN on a concatenated field.
As an example, a site with 6000+ nodes takes 39 seconds. With the part LEFT JOIN {url_alias} u ON src=CONCAT('node/',n.nid) removed, the query takes only 0.13 seconds.
This is in 4.7 and 5.x.
Any valid reason why this join is there?
Comments
Comment #1
kbahey commentedThere is another query too.
Here is a patch against 5.x
Comment #2
greg@beargroup.com commentedWorks for me, similar performance improvement on 4500 nodes. Thanks for the patch kb.
-Greg
Comment #3
darren ohFixed in CVS commit 64516.
Comment #4
darren ohI set issue 113230 as a duplicate of this issue. According to Alexander Hass, using the url() function on every link causes a much worse performance problem. If this is confirmed, I will restore the original query and eliminate the use of url().
Comment #5
darren ohFixed in CVS commit 66110.
Comment #6
(not verified) commented