[development] Slow query log
Gerhard Killesreiter
gerhard at killesreiter.de
Wed Jan 3 17:00:36 UTC 2007
Moshe Weitzman wrote:
>> One is the query from drupal_is_denied, which is run on each
>> bootstrap. This query has been improved for Drupal 5, but I think it
>> coul dbe further approved by doing away with the two LOWER()s in there
>> in case you just check an IP.
>
> i'm pretty sure you refer to this issue: http://drupal.org/node/83738
>
No, I don't. "My" LOWER is in drupal_is_denied.
> on the same topic, the main node_load() query takes on average 18ms on
> groups site which seems too high given that groups isn't all that big a
> site yet. this is a *very* frequent query. the SQL is:
>
> SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment,
> n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body,
> r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data
>
> FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN
> node_revisions r ON r.vid = n.vid
>
> WHERE n.nid = <nid>
>
> running EXPLAIN on it suggests that the JOIN with node_revisions is not
> optimized. Perhaps someone else can look at EXPLAIN for this and suggest
> a fix?
>
He, I just sent you a private mail on that matter. I forgot to attach
the log, it is in your $HOME on drupal2.
The same query works fine on d.o, but it has a slighly different key
structure:
PRIMARY KEY (`vid`),
KEY `nid` (`nid`),
KEY `uid` (`uid`)
Whereas on g.d.o it is:
PRIMARY KEY (`nid`,`vid`),
KEY `uid` (`uid`)
I had assumed that the difference would be due to the age of drupal.org,
but d.o actually has the schema that you get on a newly installed site.
So I guess you change the index and that shoul dbe all that is needed.
Cheers,
Gerhard
More information about the development
mailing list