Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGNjm-00008I-SV for pgsql-general@arkaria.postgresql.org; Fri, 04 Oct 2019 13:35:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iGNjl-0007ah-GN for pgsql-general@arkaria.postgresql.org; Fri, 04 Oct 2019 13:35:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGNjl-0007aQ-36 for pgsql-general@lists.postgresql.org; Fri, 04 Oct 2019 13:35:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iGNjj-0002Kr-0K for pgsql-general@postgresql.org; Fri, 04 Oct 2019 13:35:12 +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 x94DZ5Jv004679; Fri, 4 Oct 2019 09:35:05 -0400 From: Tom Lane To: greigwise cc: pgsql-general@postgresql.org Subject: Re: BitmapAnd on correlated column? In-reply-to: <1570195176826-0.post@n3.nabble.com> References: <1570137723639-0.post@n3.nabble.com> <1570195176826-0.post@n3.nabble.com> Comments: In-reply-to greigwise message dated "Fri, 04 Oct 2019 06:19:36 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4677.1570196105.1@sss.pgh.pa.us> Date: Fri, 04 Oct 2019 09:35:05 -0400 Message-ID: <4678.1570196105@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk greigwise writes: > Granted it cannot skip the condition, but that doesn't mean that it has to > use that second index. It's doing a recheck on the conditions anyway, > right? I'm afraid you're out of luck on that for now. In principle, the presence of extended stats on the column combination might allow the planner to figure out that the second IN condition adds little selectivity. But I'm not sure how hard it would be, and I am sure that the extended-stats logic hasn't been built out in that direction yet. regards, tom lane