Re: jsonb and nested hstore

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Tomas Vondra <tv(at)fuzzy(dot)cz>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: jsonb and nested hstore
Date: 2014-03-11 23:41:58
Message-ID: CAM3SWZSbsedz_YwsQm-chT6B6KX0rh-vke=5Nb2GBLSEm0E8AQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 11, 2014 at 3:58 PM, Tomas Vondra <tv(at)fuzzy(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2014-03-11 23:42:20 Re: [PATCH] Store Extension Options
Previous Message Tom Lane 2014-03-11 23:41:00 Re: db_user_namespace a "temporary measure"