Re: IN optimization in 7.2 ?????

From: " Mario Weilguni" <mweilguni(at)sime(dot)com>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: IN optimization in 7.2 ?????
Date: 2002-02-18 16:00:16
Message-ID: 002301c1b895$5b9bf570$bb079ac1@icomedias.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,

reading this I remembered that I had a performance problem with "IN" too,
but not with a subselect but a list of values.

I had (computed) queries like:
....
and xyz in (1,3,7,234......)
....
with up to 20 such numbers, and found out the queries to be much faster when
I wrote it this way:
....
and xyz >= 1
and xyz <= 234
and xyz in (1,3,7,234......)
....
where 1 is the minimum and 234 is the maximum of all values. The query plan
was much much better in the latter case. Don't know if something minor is
worth optimizing, but I just want let you know.

Best regards,
Mario Weilguni
----- Original Message -----
From: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: <depesz(at)depesz(dot)pl>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Monday, February 18, 2002 3:52 PM
Subject: Re: [GENERAL] IN optimization in 7.2 ?????

> hubert depesz lubaczewski wrote:
> > hi
> > was there optimization for IN (SELECT ... ) usage in 7.2?
> > we just got query which runs 7 times as fast with in than with exists !
> > the query is like select field from table where id in (select ... where
> > fieldx in (... IN (...)));
>
> Not that I know of.
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dave 2002-02-18 16:04:46 Re: Can somebody save my bacon?
Previous Message Bruce Momjian 2002-02-18 15:42:45 Re: IN optimization in 7.2 ?????