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 1htGky-0001LS-F2 for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Aug 2019 19:28:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1htGkw-0004h2-JZ for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Aug 2019 19:28:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1htGkw-0004cx-8k for pgsql-hackers@lists.postgresql.org; Thu, 01 Aug 2019 19:28:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1htGkp-0004tp-Iq for pgsql-hackers@lists.postgresql.org; Thu, 01 Aug 2019 19:28:53 +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 x71JShIN019190; Thu, 1 Aug 2019 15:28:43 -0400 From: Tom Lane To: Alexander Korotkov cc: Julien Rouhaud , Thomas Munro , Marc Cousin , Tomas Vondra , Nikita Glukhov , PostgreSQL Hackers Subject: Re: Avoid full GIN index scan when possible In-reply-to: References: <20190628161051.szk2kxmue6yjdmra@development> <4547.1561748599@sss.pgh.pa.us> <20190628195401.frwhcga76rrytbc4@development> <7773.1561752983@sss.pgh.pa.us> <27217.1564507668@sss.pgh.pa.us> <12611.1564670226@sss.pgh.pa.us> <17590.1564685940@sss.pgh.pa.us> Comments: In-reply-to Alexander Korotkov message dated "Thu, 01 Aug 2019 22:15:22 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19188.1564687723.1@sss.pgh.pa.us> Date: Thu, 01 Aug 2019 15:28:43 -0400 Message-ID: <19189.1564687723@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alexander Korotkov writes: > On Thu, Aug 1, 2019 at 9:59 PM Tom Lane wrote: >> While I've not attempted to fix that here, I wonder whether we shouldn't >> fix it by just forcing forcedRecheck to true in any case where we discard >> an ALL qualifier. > +1 for setting forcedRecheck in any case we discard ALL qualifier. > ISTM, real life number of cases we can skip recheck here is > negligible. And it doesn't justify complexity. Yeah, that was pretty much what I was thinking --- by the time we got it fully right considering nulls and multicolumn indexes, the cases where not rechecking could actually do something useful would be pretty narrow. And a bitmap heap scan is always going to have to visit the heap, IIRC, so how much could skipping the recheck really save? >> BTW, it's not particularly the fault of this patch, but: what does it >> even mean to specify GIN_SEARCH_MODE_ALL with a nonzero number of keys? > It might mean we would like to see all the results, which don't > contain given key. Ah, right, I forgot that the consistent-fn might look at the match results. regards, tom lane