Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 0FB419FB2DF for ; Sat, 27 Jan 2007 19:53:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 67569-05 for ; Sat, 27 Jan 2007 19:53:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 2A4F59FB2D6 for ; Sat, 27 Jan 2007 19:53:10 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l0RNr6E9024017; Sat, 27 Jan 2007 18:53:07 -0500 (EST) To: Ryan Holmes cc: pgsql-performance@postgresql.org Subject: Re: IN operator causes sequential scan (vs. multiple OR expressions) In-reply-to: References: Comments: In-reply-to Ryan Holmes message dated "Sat, 27 Jan 2007 15:34:56 -0800" Date: Sat, 27 Jan 2007 18:53:06 -0500 Message-ID: <24016.1169941986@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/388 X-Sequence-Number: 22989 Ryan Holmes 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