Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WGQFQ-0001ub-8N for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Feb 2014 09:48:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WGQFO-0003OW-Hg for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Feb 2014 09:48:50 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WGQFM-0003OC-UK for pgsql-hackers@postgresql.org; Thu, 20 Feb 2014 09:48:49 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WGQF9-00072g-Kc for pgsql-hackers@postgresql.org; Thu, 20 Feb 2014 09:48:47 +0000 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id C91E42AD59; Thu, 20 Feb 2014 01:48:33 -0800 (PST) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id C26F018210; Thu, 20 Feb 2014 01:48:33 -0800 (PST) Received: from zcs-prod-ext-mta-1.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id 135EF120033; Thu, 20 Feb 2014 01:48:33 -0800 (PST) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA; Thu, 20 Feb 2014 01:48:31 -0800 (PST) Message-ID: <5305CF6E.1080508@vmware.com> Date: Thu, 20 Feb 2014 11:48:30 +0200 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10 MIME-Version: 1.0 To: Alexander Korotkov CC: Tomas Vondra , pgsql-hackers Subject: Re: GIN improvements part2: fast scan References: <52E141BA.5000302@vmware.com> <52E4141E.60609@fuzzy.cz> <52E42AD0.5060600@vmware.com> <52E4AA3A.9000607@fuzzy.cz> <52E53458.2010106@vmware.com> <52F36245.6070006@vmware.com> <52F4E094.9040303@vmware.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.5 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 02/09/2014 12:11 PM, Alexander Korotkov wrote: > I've rebased catalog changes with last master. Patch is attached. I've > rerun my test suite with both last master ('committed') and attached > patch ('ternary-consistent'). Thanks! > method | sum > ------------------------+------------------ > committed | 143491.715000001 > fast-scan-11 | 126916.111999999 > fast-scan-light | 137321.211 > fast-scan-light-heikki | 138168.028000001 > master | 446976.288 > ternary-consistent | 125923.514 > > I explain regression in last master by change of MAX_MAYBE_ENTRIES from 8 > to 4. Yeah, probably. I set MAX_MAYBE_ENTRIES to 8 in initial versions to make sure we get similar behavior in Tomas' tests that used 6 search terms. But I always felt that it was too large for real queries, once we have the catalog changes, that's why I lowered to 4 when committing. If an opclass benefits greatly from fast scan, it should provide the ternary consistent function, and not rely on the shim implementation. > I'm not sure about decision to reserve separate procedure number for > ternary consistent. Probably, it would be better to add ginConfig method. > It would be useful for post 9.4 improvements. Hmm, it might be useful for an opclass to provide both, a boolean and ternary consistent function, if the boolean version is significantly more efficient when all the arguments are TRUE/FALSE. OTOH, you could also do a quick check through the array to see if there are any MAYBE arguments, within the consistent function. But I'm inclined to keep the possibility to provide both versions. As long as we support the boolean version at all, there's not much difference in terms of the amount of code to support having them both for the same opclass. A ginConfig could be useful for many other things, but I don't think it's worth adding it now. What's the difference between returning GIN_MAYBE and GIN_TRUE+recheck? We discussed that earlier, but didn't reach any conclusion. That needs to be clarified in the docs. One possibility is to document that they're equivalent. Another is to forbid one of them. Yet another is to assign a different meaning to each. I've been thinking that it might be useful to define them so that a MAYBE result from the tri-consistent function means that it cannot decide if you have a match or not, because some of the inputs were MAYBE. And TRUE+recheck means that even if all the MAYBE inputs were passed as TRUE or FALSE, the result would be the same, TRUE+recheck. The practical difference would be that if the tri-consistent function returns TRUE+recheck, ginget.c wouldn't need to bother fetching the other entries, it could just return the entry with recheck=true immediately. While with MAYBE result, it would fetch the other entries and call tri-consistent again. ginget.c doesn't currently use the tri-consistent function that way - it always fetches all the entries for a potential match before calling tri-consistent, but it could. I had it do that in some of the patch versions, but Tomas' testing showed that it was a big loss on some queries, because the consistent function was called much more often. Still, something like that might be sensible in the future, so it might be good to distinguish those cases in the API now. Note that ginarrayproc is already using the return values like that: in GinContainedStrategy, it always returns TRUE+recheck regardless of the inputs, but in other cases it uses GIN_MAYBE. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers