Skip site navigation (1) Skip section navigation (2)

Re: IN operator causes sequential scan (vs. multiple OR expressions)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ryan Holmes <ryan(at)hyperstep(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: IN operator causes sequential scan (vs. multiple OR expressions)
Date: 2007-01-27 23:53:06
Message-ID: 24016.1169941986@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
Ryan Holmes <ryan(at)hyperstep(dot)com> writes:
> I have a relatively simple query where the planner chooses a  
> sequential scan when using the IN operator but chooses an index scan  
> when using logically equivalent multiple OR expressions.

EXPLAIN ANALYZE for both, please?

If you set enable_seqscan = off, does that force an indexscan, and if so
what does EXPLAIN ANALYZE show in that case?

			regards, tom lane

In response to

Responses

pgsql-performance by date

Next:From: Ryan HolmesDate: 2007-01-28 01:34:12
Subject: Re: IN operator causes sequential scan (vs. multiple OR expressions)
Previous:From: Ryan HolmesDate: 2007-01-27 23:34:56
Subject: IN operator causes sequential scan (vs. multiple OR expressions)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group