Re: query slow problem

From: Andrew Sullivan <andrew(at)libertyrms(dot)info>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: query slow problem
Date: 2002-07-29 15:45:27
Message-ID: 20020729114527.G13977@mail.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jul 29, 2002 at 05:16:40PM +0200, frank_lupo wrote:
> select id,de2 from irtab where id in (select distinct(ruolofunz) from
> irelbtes_1 where entpian=118331)\g

Don't use IN. It's slow. Try this:

select id,de2 from irtab where exists (select distinct(ruolofunz)
from irelbtes_1 where entpian=118331 and ruolofunz=id)

Or maybe

select distinct on (ruolofunz) id, de2 from irtab, irelbtes_1 where
id = ruolofunz and entpian=118331

A

--
----
Andrew Sullivan 87 Mowat Avenue
Liberty RMS Toronto, Ontario Canada
<andrew(at)libertyrms(dot)info> M6K 3E3
+1 416 646 3304 x110

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Oleg Bartunov 2002-07-29 15:50:40 Re: Using FTI-Search (likely a more general
Previous Message Markus Wollny 2002-07-29 15:38:59 Re: tsearch - Regression tests fail