Re: Postgres is too slow?
Richard Huxton <dev@archonet.com>
From: "Richard Huxton" <dev@archonet.com>
To: "Richard Huxton" <dev@archonet.com>, "Paul Mamin" <magamos@mail.ru>
Cc: <pgsql-general@postgresql.org>
Date: 2001-06-22T11:26:15Z
Lists: pgsql-general
From: "Richard Huxton" <dev@archonet.com> > Paul Mamin wrote: > > > > The SQL command I need to request: > > ---------------------------------------------------------------- > > select numberid, sum(TarifDurationAir-CallDuration)/count(*) > > from callbase > > group by numberid; > > ---------------------------------------------------------------- Made up some test data (3491 values of numberid, 140 entries for each). Timings I'm getting on an old AMD-K6ii - 400Mhz w/256 MB (and a lot of quiescent apps) For your query: 54secs By setting sort_mem to 8192 (8MB) I get a time of 49s but at the cost of a much larger backend process. Just doing: SELECT numberid FROM callbase GROUP BY numberid; Gives a timing of 34secs. Disk activity is minimal - CPU is maxed out in user processing. I'd expect your setup to be 10% faster at least. HTH - Richard Huxton