Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id BF1B99FA304 for ; Fri, 20 Apr 2007 02:15:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 30953-08-3 for ; Fri, 20 Apr 2007 02:15:01 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by postgresql.org (Postfix) with ESMTP id 20E869FB8DF for ; Fri, 20 Apr 2007 02:13:44 -0300 (ADT) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis), id 0ML29c-1HelRG3BMD-0003J1; Fri, 20 Apr 2007 07:13:43 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1HelRG-00044O-00 for pgsql-sql@postgresql.org; Fri, 20 Apr 2007 07:13:42 +0200 Date: Fri, 20 Apr 2007 07:13:42 +0200 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: many 'OR' in WHERE-condition Message-ID: <20070420051341.GA15322@a-kretschmer.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! User-Agent: Mutt/1.5.9i X-Provags-ID: V01U2FsdGVkX18f10StNGT/eMHWQjSyEEZimQivSyJuVce/vWQ qWDLPzbeqxGuJpRRs4X1cBUMepuc7FZIpa0cBqJtzAgBbaqNHC 6kX5rg1dzP0DH/fiJtiHi5ph9fuCq89 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/170 X-Sequence-Number: 28170 Hello, a friend of mine has got a problem: in a SELECT with a condition 'WHERE foo IN (1,2,3,4,...)' with a large list within. The optimizer choose a rewrite to many OR's and a bitmap index scan on the index, no problem, fast. But if the list increase the planner choose an seq-scan. The amount of values in the list is about 200 and the table has about 250.000 rows. How can we avoid the seq-scan? Andreas, thx in advance. -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net