Re: Seq Scans when index expected to be used

From: "jasiek" <jasiek(at)klaster(dot)net>
To: ow <oneway_111(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Seq Scans when index expected to be used
Date: 2003-11-29 17:21:23
Message-ID: 20031129170913.M37199@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-11-29 17:24:10 Re: Seq Scans when index expected to be used
Previous Message ow 2003-11-29 16:49:24 Seq Scans when index expected to be used