Help with GROUP BY

From: Jean-Christophe Boggio <cat(at)thefreecat(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Help with GROUP BY
Date: 2000-11-05 18:03:28
Message-ID: 15127090156.20001105190328@thefreecat.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I have a (quite) big table with ~3M rows.

Every row has a NBPOINTS (int4) and a REASON (int4)

select sum(nbpoints) from points;
it takes about 10s

select sum(nbpoints) from points group by reason
it takes about 210s

Same table structure, same data on Oracle gives respectively 8 and 22
seconds.

Is there a way to optimize this ?

(REASON is indexed though I can see no interest in this query.)

TIA!

--
Jean-Christophe Boggio
cat(at)thefreecat(dot)org
Independant Consultant and Developer
Delphi, Linux, Oracle, Perl

Browse pgsql-sql by date

  From Date Subject
Next Message Indraneel Majumdar 2000-11-05 19:03:31 Conditional SQL query
Previous Message hubert depesz lubaczewski 2000-11-05 11:50:03 Time penalty on VIEWS on VIEWS