Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id eA96QYs96034 for ; Thu, 9 Nov 2000 01:26:34 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from miaou.thefreecat.org ([213.11.8.225]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eA5I3xs36926 for ; Sun, 5 Nov 2000 13:04:01 -0500 (EST) (envelope-from cat@thefreecat.org) Received: from bast.thefreecat.local (bast.thefreecat.local [192.168.0.2]) by miaou.thefreecat.org (Postfix) with ESMTP id 0DF4E93029 for ; Sun, 5 Nov 2000 19:03:41 +0100 (CET) Date: Sun, 5 Nov 2000 19:03:28 +0100 From: Jean-Christophe Boggio X-Mailer: The Bat! (v1.46d) Personal Reply-To: Jean-Christophe Boggio X-Priority: 3 (Normal) Message-ID: <15127090156.20001105190328@thefreecat.org> To: pgsql-sql@postgresql.org Subject: Help with GROUP BY Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200011/63 X-Sequence-Number: 94 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