Re: IN optimization in 7.2 ????? - Mailing list pgsql-general

From Mario Weilguni
Subject Re: IN optimization in 7.2 ?????
Date
Msg-id 002301c1b895$5b9bf570$bb079ac1@icomedias.com
Whole thread Raw
In response to Re: IN optimization in 7.2 ?????  (Bruce Momjian <pgman@candle.pha.pa.us>)
List 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@candle.pha.pa.us>
To: <depesz@depesz.pl>
Cc: <pgsql-general@postgresql.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@candle.pha.pa.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@postgresql.org
>



pgsql-general by date:

Previous
From: Karl DeBisschop
Date:
Subject: Re: [HACKERS] Feature enhancement request : use of libgda
Next
From: Jean-Luc Lachance
Date:
Subject: Re: calculating spherical distance in sql