X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CAE2732A821 for ; Fri, 8 Oct 2004 15:03:42 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30015-06 for ; Fri, 8 Oct 2004 14:03:33 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7E6C832A641 for ; Fri, 8 Oct 2004 15:03:35 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id i98E3RQn011973; Fri, 8 Oct 2004 10:03:27 -0400 (EDT) To: Dawid Kuroczko Cc: pgsql-performance@postgresql.org Subject: Re: integer[] indexing. In-reply-to: <758d5e7f041008021163fb40eb@mail.gmail.com> References: <758d5e7f041008021163fb40eb@mail.gmail.com> Comments: In-reply-to Dawid Kuroczko message dated "Fri, 08 Oct 2004 11:11:16 +0200" Date: Fri, 08 Oct 2004 10:03:26 -0400 Message-ID: <11972.1097244206@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=MAILTO_TO_SPAM_ADDR X-Spam-Level: * X-Archive-Number: 200410/102 X-Sequence-Number: 8578 Dawid Kuroczko writes: > But when I phrase the query: > SELECT * FROM table WHERE (icount(ids) <= 1 AND ids[1] = 33) OR > (icount(ids) > 1 AND ids && '{33}'); > Planner insists on using seqscan. Even with enable_seqscan = off; The OR-index-scan mechanism isn't currently smart enough to use partial indexes that are only valid for some of the OR'd clauses rather than all of them. Feel free to fix it ;-). (This might not even be very hard; I haven't looked.) regards, tom lane