Re: Slow Queries with OR's?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Mad Hatter" <mad_hatter_(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Slow Queries with OR's?
Date: 2003-04-29 14:22:15
Message-ID: 26377.1051626135@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Mad Hatter" <mad_hatter_(at)hotmail(dot)com> writes:
> When I run the following query:
> SELECT attrib1 FROM table1 WHERE attrib2 IN ( '1', '3', '5', '7' );

Could we see the EXPLAIN ANALYZE output for that, as well as one of
these?

> SELECT attrib1 FROM table1 WHERE attrib2 = '1'

ISTM you should be getting roughly equivalent plans, that is an
indexscan for each of the constants.

(The nearby comments about IN being slow apply to "foo IN (SELECT ...)"
which this is not.)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dennis Gearon 2003-04-29 15:04:47 Re: Bug(?) with cursors using aggregate functions.
Previous Message Tom Lane 2003-04-29 14:11:19 Re: Backend memory leakage when inserting