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