X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A55D0D1D8B8 for ; Sat, 29 Nov 2003 17:22:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 28503-09 for ; Sat, 29 Nov 2003 13:22:12 -0400 (AST) Received: from serwer.skawsoft.com.pl (skawina.eu.org [80.48.213.66]) by svr1.postgresql.org (Postfix) with ESMTP id 0F5B4D1D923 for ; Sat, 29 Nov 2003 13:21:47 -0400 (AST) Received: from klaster.net (localhost [127.0.0.1]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id E00A62B3FD; Sat, 29 Nov 2003 18:21:23 +0100 (CET) From: "jasiek" To: ow , pgsql-sql@postgresql.org Subject: Re: Seq Scans when index expected to be used Date: Sat, 29 Nov 2003 19:21:23 +0200 Message-Id: <20031129170913.M37199@klaster.net> In-Reply-To: <20031129164924.51035.qmail@web21401.mail.yahoo.com> References: <20031129164924.51035.qmail@web21401.mail.yahoo.com> X-Mailer: Open WebMail 2.10 20030617 X-OriginatingIP: 80.50.23.62 (jasiek@klaster.net) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/340 X-Sequence-Number: 16155 On Sat, 29 Nov 2003 08:49:24 -0800 (PST), ow wrote > explain select b, c, a > from test > group by b, c, a > having count(*) > 1 I'm not sure about 7.4 aggregate improvements, but <=7.3 didn't work good with aggregates at all. Maybe it's not directly an answer to your question, but try theses queries: select t1.b,t1.c,t1.a from test t1 join test t2 using (b,c,a) where t2.id<>t1.id group by t1.b,t1.c,t1.a or select a,b,c from test t1 where exists (select * from test t2 where t2.a=t1.a and t2.b=t1.b and t2.c=t1.c and t1.id<>t2.id) group by a,b,c Regards, Tomasz Myrta