Re: jsonb and nested hstore - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: jsonb and nested hstore
Date
Msg-id CAM3SWZSbsedz_YwsQm-chT6B6KX0rh-vke=5Nb2GBLSEm0E8AQ@mail.gmail.com
Whole thread Raw
In response to Re: jsonb and nested hstore  (Tomas Vondra <tv@fuzzy.cz>)
Responses Re: jsonb and nested hstore  (Peter Geoghegan <pg@heroku.com>)
Re: jsonb and nested hstore  ("Tomas Vondra" <tv@fuzzy.cz>)
List pgsql-hackers
On Tue, Mar 11, 2014 at 3:58 PM, Tomas Vondra <tv@fuzzy.cz> wrote:
>   ERROR:  index row size 1416 exceeds maximum 1352 for index "gin_idx"

All index AMs have similar restrictions.

> A good example of such header is "dkim-signature" which basically
> contains the whole message digitally signed with DKIM. The signature
> tends to be long and non-compressible, thanks to the signature.
>
> I'm wondering what's the best way around this, because I suspect many
> new users (especially those attracted by jsonb and GIN improvements)
> will run into this. Maybe not immediately, but eventully they'll try to
> insert a jsonb with long value, and it will fail ...

The jsonb_hash_ops operator class just stores a 32-bit integer hash
value (it always sets the recheck flag, which only some of the other
default GIN opclass' strategies do). It only supports containment, and
not the full variety of operators that the default opclass supports,
which is why it isn't the default. I think that in practice the
general recommendation will be that when indexing at the "top level",
use jsonb_hash_ops. When indexing nested items, use the more flexible
default GIN opclass. That seems like a pretty smart trade-off to me.

The more I think about it, the more inclined I am to lose GiST support
entirely for the time being. It lets us throw out about 700 lines of C
code, which is a very significant fraction of the total, removes the
one open bug, and removes the least understood part of the code. The
GiST opclass is not particularly compelling for this.

-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: db_user_namespace a "temporary measure"
Next
From: Simon Riggs
Date:
Subject: Re: [PATCH] Store Extension Options