This is showing up on the groups.drupal.org slow query log. uses some non standard (for drupal) constructs. note that i only have 5 helptips.

SELECT ht.* FROM node n LEFT JOIN helptip ht ON ht.nid = n.nid LEFT JOIN helptip_user_data ht_hidden ON ht_hidden.uid=1 AND ht_hidden.nid=n.nid AND ht_hidden.relation='hidden' WHERE n.status = 1 AND ht_hidden.relation IS NULL AND ('node' LIKE ht.path) AND weight >= -10 AND weight <= 10 ORDER BY ht.weight, RAND() LIMIT 1;

Comments

Dave Cohen’s picture

Looks like the exact query was cut off in your post.

I recognize this is a complicated query, with a 'like' comparison that may be particularly expensive. If there is an easy way to improve the query, I don't know it because I don't know the inner workings of the database that well.

There could also be some improvement by adding indexes to the tables. I really don't know for sure. I'm open to any suggestions here.