Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WjE6c-0002uz-A9 for pgsql-hackers@arkaria.postgresql.org; Sat, 10 May 2014 20:42:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WjE6b-0007QY-2d for pgsql-hackers@arkaria.postgresql.org; Sat, 10 May 2014 20:42:49 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WjE6a-0007QQ-04 for pgsql-hackers@postgresql.org; Sat, 10 May 2014 20:42:48 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WjE6W-0002Tu-LE for pgsql-hackers@postgresql.org; Sat, 10 May 2014 20:42:47 +0000 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 086C52892A; Sat, 10 May 2014 13:42:43 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (zcs-prod-ext-mta-2.vmware.com [10.113.62.224]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 0281F40FFC; Sat, 10 May 2014 13:42:43 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id A1934C004E; Sat, 10 May 2014 13:42:47 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA; Sat, 10 May 2014 13:42:45 -0700 (PDT) Message-ID: <536E8F3A.40706@vmware.com> Date: Sat, 10 May 2014 23:42:34 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.4.0 MIME-Version: 1.0 To: Tom Lane , Greg Stark CC: Bruce Momjian , Gavin Flower , "David E. Wheeler" , Robert Haas , Andrew Dunstan , Peter Geoghegan , "pgsql-hackers@postgresql.org" Subject: Re: default opclass for jsonb (was Re: Call for GIST/GIN/SP-GIST opclass documentation) References: <16769.1399407530@sss.pgh.pa.us> <20140506212020.GK30817@momjian.us> <57E8AA44-F816-45F2-BB61-5A854FFB0A97@justatheory.com> <28554.1399414853@sss.pgh.pa.us> <20140508134701.GO30817@momjian.us> <5819.1399558614@sss.pgh.pa.us> <1888.1399588751@sss.pgh.pa.us> <20140509033405.GA23254@momjian.us> <536C550F.50108@archidevsys.co.nz> <18360.1399633457@sss.pgh.pa.us> <20140509135336.GC23254@momjian.us> <28961.1399668272@sss.pgh.pa.us> In-Reply-To: <28961.1399668272@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.6 (-------) 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 05/09/2014 11:44 PM, Tom Lane wrote: > Greg Stark writes: >> Well the question seems to me to be that if we're always doing recheck >> then what advantage is there to not hashing everything? > > Right now, there's not much. But it seems likely to me that there will be > more JSON operators in future, and some of them might be able to make use > of the additional specificity of unhashed entries. For example, it's only > a very arbitrary definitional choice for the exists operator (ie, not > looking into sub-objects) that makes jsonb_ops lossy for it. We might > eventually build a recursive-exists-check operator for which the index > could be lossless, at least up to the string length where we start to > hash. Back to the naming: The main difference between the two opclasses from a user's standpoint is not whether they hash or not. The big difference is that one indexes complete paths from the root, and the other indexes just the "leaf" level. For example, if you have an object like '{"foo": {"bar": 123 } }', one will index "foo", "foo->bar", and "foo->bar->123" while the other will index "foo", "bar" and "123". Whether the opclasses use hashing to shorten the key is an orthogonal property, and IMHO not as important. To reflect that, I suggest that we name the opclasses: json_path_ops json_value_ops or something along those lines. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers