From: | "Jaime Casanova" <systemguards(at)gmail(dot)com> |
---|---|
To: | Oswaldo Hernández <listas(at)soft-com(dot)es> |
Cc: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: Problema SQL |
Date: | 2007-02-16 05:11:51 |
Message-ID: | c2d9e70e0702152111h1ea5c220kd77fb25b79a2e0a7@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
On 2/15/07, Oswaldo Hernández <listas(at)soft-com(dot)es> wrote:
> xx=# select valor
> xx-# from valorescomunes
> xx-# group by valor
> xx-# having count(valor) = (select count(claves.clave) from (select distinct clave from
> valorescomunes) as claves);
el query queda mejor asi, corriendo un explain analyze en ambos veo
que mi version elimina un paso Sort y uno Unique que incluye el plan
del query que pasaste en tablas grandes eso puede hacer la diferencia
:)
select valor
from valorescomunes
group by valor
having count(valor) = (select count(distinct clave) from valorescomunes);
--
Atentamente,
Jaime Casanova
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook
From | Date | Subject | |
---|---|---|---|
Next Message | Jaime Casanova | 2007-02-16 05:30:34 | Re: Orientacion Sobre Comparativa entre postgres y mssql |
Previous Message | Mario | 2007-02-16 04:32:10 | Re: LATAM postgresql users |