gsitemap queries are very slow queries eating up my CPU...

# Time: 071106 22:56:58
# User@Host: cheatmaster[cheatmaster] @ localhost []
# Query_time: 359  Lock_time: 0  Rows_sent: 9090  Rows_examined: 95122758
SELECT 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 ('') AND n.nid >= 0 AND n.nid < 10000;

# Time: 071106 23:02:04
# User@Host: cheatmaster[cheatmaster] @ localhost []
# Query_time: 426  Lock_time: 0  Rows_sent: 9090  Rows_examined: 95122758
SELECT 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 ('') AND n.nid >= 0 AND n.nid < 10000;

# Time: 071106 23:17:12
# User@Host: cheatmaster[cheatmaster] @ localhost []
# Query_time: 83  Lock_time: 0  Rows_sent: 1428  Rows_examined: 14955444
use cheats;
SELECT 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 ('') AND n.nid >= 10000 AND n.nid < 20000;

# Time: 071106 23:22:59
# User@Host: cheatmaster[cheatmaster] @ localhost []
# Query_time: 333  Lock_time: 0  Rows_sent: 9090  Rows_examined: 95159106
SELECT 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 ('') AND n.nid >= 0 AND n.nid < 10000;

Comments

ednique’s picture

In case you are wondering... I have 10.553 nodes

darren oh’s picture

This has been solved in the 5.x versions. A patch for 4.7.x would be welcome.

ednique’s picture

I simply removed LEFT JOIN {url_alias} u ON src = CONCAT('node/', n.nid) as it is actually not used and its this part that causes the tremendous delay...

darren oh’s picture

Status: Active » Fixed

Fixed in CVS commit 87656.

darren oh’s picture

Version: 4.7.x-1.x-dev » 4.7.x-1.0
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.