Re: Query performance question

David Olbersen <dave@slickness.org>

From: David Olbersen <dave@slickness.org>
To: Lukas Ertl <l.ertl@univie.ac.at>
Cc: <pgsql-novice@postgresql.org>
Date: 2001-03-28T20:54:39Z
Lists: pgsql-novice
On Wed, 28 Mar 2001, Lukas Ertl wrote:

There are two things you should do first:

1) VACUUM ANALYZE hits;
2) VACUUM ANALYZE referrer;

If it's still running slowly, try EXPLAINing your SELECT to us.

Also, it's been my experience that LIMIT's slow down a query, though I could be
dead wrong.


> SELECT count(*), url FROM hits, referrer WHERE referrer.id = referrer_id
> GROUP BY url ORDER BY count DESC LIMIT 10;
>
> And this query takes almost five seconds to complete, and that seems to me
> quite slow. The database is running on a Duron 700 with 256 MB RAM and
> ATA-66 disks. Operating system is FreeBSD-4.2.
>
> Are there some tuning knobs I could turn?

-- Dave