Re: [HACKERS] having and union in v7beta - Mailing list pgsql-hackers

From Jose Soares
Subject Re: [HACKERS] having and union in v7beta
Date
Msg-id 38BD19FE.D02C383B@sferacarta.com
Whole thread Raw
In response to having and union in v7beta  (Jose Soares <jose@sferacarta.com>)
Responses rpms
List pgsql-hackers
Tom Lane wrote:

> Jose Soares <jose@sferacarta.com> writes:
> > I tried the following query :
>
> > select * from comuni where nome in (
> >      select nome from comuni group by nome having 1 < count(nome)
> >      );
>
> > on the above table populated with 8342 rows, PostgreSQL begins searching
> > and I wait for hours without any result.
>
> I'd expect that to be pretty slow, since it's going to execute the inner
> select for every tuple examined by the outer select.  Shouldn't be any
> worse than 6.5 though.  IN (sub-SELECT) has always been slow.
>
>

In v7.0 this query takes more than 50min to execute, it doesn't work on
v6.5...

select * from comuni where nome in (    select nome from comuni group by nome having count(nome) > 1    );

real    50m25.033s
user    0m0.010s
sys     0m0.000s

--
Jose' Soares
Bologna, Italy                     Jose@sferacarta.com




pgsql-hackers by date:

Previous
From: Jose Soares
Date:
Subject: Re: [HACKERS] having and union in v7beta
Next
From: "Sergio A. Kessler"
Date:
Subject: rpms