Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WibZf-0007LB-NO for pgsql-hackers@arkaria.postgresql.org; Fri, 09 May 2014 03:34:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WibZe-0005zs-VL for pgsql-hackers@arkaria.postgresql.org; Fri, 09 May 2014 03:34:15 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WibZc-0005zh-Gc for pgsql-hackers@postgresql.org; Fri, 09 May 2014 03:34:12 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WibZZ-0000nY-Dx for pgsql-hackers@postgresql.org; Fri, 09 May 2014 03:34:11 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1WibZV-0000qU-7a; Thu, 08 May 2014 23:34:05 -0400 Date: Thu, 8 May 2014 23:34:05 -0400 From: Bruce Momjian To: Tom Lane Cc: "David E. Wheeler" , Greg Stark , Robert Haas , Heikki Linnakangas , Andrew Dunstan , Peter Geoghegan , "pgsql-hackers@postgresql.org" Subject: Re: default opclass for jsonb (was Re: Call for GIST/GIN/SP-GIST opclass documentation) Message-ID: <20140509033405.GA23254@momjian.us> References: <20140422223230.GL10046@momjian.us> <16527.1398214220@sss.pgh.pa.us> <20140506201048.GI30817@momjian.us> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1888.1399588751@sss.pgh.pa.us> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.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 Thu, May 8, 2014 at 06:39:11PM -0400, Tom Lane wrote: > I wrote: > > I think the idea of hashing only keys/values that are "too long" is a > > reasonable compromise. I've not finished coding it (because I keep > > getting distracted by other problems in the code :-() but it does not > > look to be very difficult. I'm envisioning the cutoff as being something > > like 128 bytes; in practice that would mean that few if any keys get > > hashed, I think. > > Attached is a draft patch for this. In addition to the hash logic per se, > I made these changes: > > * Replaced the K/V prefix bytes with a code that distinguishes the types > of JSON values. While this is not of any huge significance for the > current index search operators, it's basically free to store the info, > so I think we should do it for possible future use. > > * Fixed the problem with "exists" returning rows it shouldn't. I > concluded that the best fix is just to force recheck for exists, which > allows considerable simplification in the consistent functions. > > * Tried to improve the comments in jsonb_gin.c. > > Barring objections I'll commit this tomorrow, and also try to improve the > user-facing documentation about the jsonb opclasses. Looks good. I was thinking the jsonb_ops name could remain unchanged and the jsonb_hash_ops could be called jsonb_combo_ops as it combines the key and value into a single index entry. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers