Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fioMh-0003rK-S4 for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Jul 2018 22:04:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fioMg-0000Hz-Da for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Jul 2018 22:04:06 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fioMg-0000Hs-4L for pgsql-bugs@lists.postgresql.org; Thu, 26 Jul 2018 22:04:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fioMd-00032g-Ph for pgsql-bugs@postgresql.org; Thu, 26 Jul 2018 22:04:04 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w6QM41w5019852; Thu, 26 Jul 2018 18:04:01 -0400 From: Tom Lane To: Soni M cc: Postgres Bug Subject: Re: Scanning all partition when more than 100 items in "where id in ()" clause In-reply-to: References: Comments: In-reply-to Soni M message dated "Fri, 27 Jul 2018 02:46:28 +0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19850.1532642641.1@sss.pgh.pa.us> Date: Thu, 26 Jul 2018 18:04:01 -0400 Message-ID: <19851.1532642641@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Soni M writes: > Hello All, I think I found bug here. Postgres 9.6.9 on Red Hat Enterprise > Linux Server release 7.5 (Maipo). I think it's a consequence of the limitation in predtest.c that it won't try to do predicate proofs using ScalarArrayOps with more than 100 array entries: /* * Proof attempts involving large arrays in ScalarArrayOpExpr nodes are * likely to require O(N^2) time, and more often than not fail anyway. * So we set an arbitrary limit on the number of array elements that * we will allow to be treated as an AND or OR clause. * XXX is it worth exposing this as a GUC knob? */ #define MAX_SAOP_ARRAY_SIZE 100 Not a bug, but a tradeoff. You'd be unhappy if the planner spent longer devising the plan than it saved to eliminate the extra partitions. regards, tom lane