From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Greg Stark <stark(at)mit(dot)edu>, Robert Haas <robertmhaas(at)gmail(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Geoghegan <pg(at)heroku(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: default opclass for jsonb (was Re: Call for GIST/GIN/SP-GIST opclass documentation) |
Date: | 2014-05-08 14:16:54 |
Message-ID: | 5819.1399558614@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs pgsql-hackers |
Bruce Momjian <bruce(at)momjian(dot)us> writes:
> On Tue, May 6, 2014 at 06:20:53PM -0400, Tom Lane wrote:
>> I wonder why there's not an option to store keys and values separately,
>> but as hashes not as the original strings, so that indexability of
>> everything could be guaranteed. Or a variant of that might be to hash
>> only strings that are too large to fit in an index entry, and force
>> recheck only when searching for a string that needed hashing.
>>
>> I wonder whether the most effective use of time at this point
>> wouldn't be to fix jsonb_ops to do that, rather than arguing about
>> what to rename it to. If it didn't have the failure-for-long-strings
>> problem I doubt anybody would be unhappy about making it the default.
> Can we hash just the values, not the keys, in jsonb_ops, and hash the
> combo in jsonb_hash_ops. That would give us key-only lookups without a
> recheck.
No, because there's nothing in JSON limiting the length of keys, any more
than values.
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.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2014-05-08 14:34:04 | Re: default opclass for jsonb (was Re: Call for GIST/GIN/SP-GIST opclass documentation) |
Previous Message | Bruce Momjian | 2014-05-08 13:47:01 | Re: default opclass for jsonb (was Re: Call for GIST/GIN/SP-GIST opclass documentation) |
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2014-05-08 14:25:24 | Re: [v9.5] Custom Plan API |
Previous Message | Simon Riggs | 2014-05-08 14:03:40 | Re: [v9.5] Custom Plan API |