RE: Really SLOW using GROUP BY ...!? - Mailing list pgsql-general

From Mikheev, Vadim
Subject RE: Really SLOW using GROUP BY ...!?
Date
Msg-id 8F4C99C66D04D4118F580090272A7A234D315F@sectorbase1.sectorbase.com
Whole thread Raw
In response to Really SLOW using GROUP BY ...!?  (Hervé Piedvache <herve@elma.fr>)
Responses Re: Really SLOW using GROUP BY ...!?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
> But when I do :
> select sum(points) from gains group by idcond;
>
> With Oracle : 22 sec
> With PostGreSQL : about 3 minutes !!!

Try

select sum(points) from gains where idcond >= _minimum_id_cond_value_
group by idcond;

to see if forced index usage will help. Unfortunately, PG will anyway
try to sort result before grouping, but probably this trick will help
somehow. Also, use -S 2048 (or more) backend arg to increase sort
memory size.

Vadim

pgsql-general by date:

Previous
From: Hervé Piedvache
Date:
Subject: Really SLOW using GROUP BY ...!?
Next
From: oberpwd@anubis.network.com (Wade D. Oberpriller)
Date:
Subject: Built-in Postgres Types as shown in Chap. 4 Programmer's Guide