pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jean-Christophe Boggio <cat@thefreecat.org>
To: pgsql-sql@postgresql.org
Subject: Help with GROUP BY
Date: Sun, 5 Nov 2000 19:03:28 +0100
Message-ID: <15127090156.20001105190328@thefreecat.org> (raw)

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@thefreecat.org
Independant Consultant and Developer
Delphi, Linux, Oracle, Perl





Message-ID: <15127090156.20001105190328@thefreecat.org>
Permalink:  ../15127090156.20001105190328@thefreecat.org/
Also on:    postgresql.org/message-id/15127090156.20001105190328@thefreecat.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: cat@thefreecat.org
  Subject: Re: Help with GROUP BY
  In-Reply-To: <15127090156.20001105190328@thefreecat.org>
  References: <15127090156.20001105190328@thefreecat.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox