Re: Re: Slow SELECT...IN statements

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Matt Friedman" <matt(at)sprynewmedia(dot)com>
Cc: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "PgSql General List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Re: Slow SELECT...IN statements
Date: 2001-03-23 21:06:08
Message-ID: 10130.985381568@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Matt Friedman" <matt(at)daart(dot)ca> writes:
> I am working on a select that would use the IN statement as you can view
> below.

> WHERE
> index_word.word IN ('radio','spry')

The above is perfectly OK. It's really just a shorthand for
index_word.word = 'radio' OR index_word.word = 'spry'
anyway.

> After reading this thread, which says that the IN statement is "slow" I am
> wondering how I would rewrite using "EXISTS...IN"

The thread was about "foo IN (SELECT ...)". A sub-select IN is a
completely different animal from IN (list-of-values).

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-03-23 21:20:07 Re: indexes not working very well
Previous Message Matt Friedman 2001-03-23 20:52:25 Re: Slow SELECT...IN statements