Re: Re: Slow SELECT...IN statements - Mailing list pgsql-general

From Tom Lane
Subject Re: Re: Slow SELECT...IN statements
Date
Msg-id 10130.985381568@sss.pgh.pa.us
Whole thread Raw
In response to Re: Slow SELECT...IN statements  ("Matt Friedman" <matt@daart.ca>)
List pgsql-general
"Matt Friedman" <matt@daart.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

pgsql-general by date:

Previous
From: "Matt Friedman"
Date:
Subject: Re: Slow SELECT...IN statements
Next
From: Tom Lane
Date:
Subject: Re: indexes not working very well