[drupal-devel] Fwd: history-table

Gerhard Killesreiter killesreiter at physik.uni-freiburg.de
Mon May 9 12:11:23 UTC 2005



On Mon, 9 May 2005, Gerhard Killesreiter wrote:

> On Mon, 9 May 2005, Dries Buytaert wrote:
>
> > Begin forwarded message:
> >
> > > From: Dries Buytaert <dries at buytaert.net>
> > > Date: Sat 7 May 2005 13:45:43 CEST
> > >
> > > From profiling drupal.org, it seems that updating entries in (or
> > > inserting entries into) the history-table can be quite slow.  Turns
> > > out the table it pretty big, so I'm not sure it is missing an index or
> > > two.
> > >
> > > mysql> select count(*) from history;
> > > +----------+
> > > | count(*) |
> > > +----------+
> > > |   123805 |
> > > +----------+
> > > 1 row in set (0.00 sec)
> >
> > I spent the past 2 days keeping an eye on this, and it is certainly a
> > performance bottleneck.  Querying or updating the history table takes 6
> > ms whereas other SQL queries take about 0.2 - 0.3 ms on average.  That
> > is, we can do 20 to 30 other SQL queries in 6 ms.  Something to think
> > about.

We have two different implementations of checking the new-ness of a node
wrt the current user:

_forum_user_last_visit selects all history entries and populates a
static array when first called.

and

node_last_viewed will execute a query per nid (and cache the result in
a static array too).

We should find out which one is faster, use only that, and remove the
other function (the new function should be in node.module of course).

Cheers,
	Gerhard




More information about the drupal-devel mailing list