On 08/26/2014 07:51 AM, Tom Lane wrote:
> My feeling about it at this point is that the apparent speed gain from
> using offsets is illusory: in practically all real-world cases where there
> are enough keys or array elements for it to matter, costs associated with
> compression (or rather failure to compress) will dominate any savings we
> get from offset-assisted lookups. I agree that the evidence for this
> opinion is pretty thin ... but the evidence against it is nonexistent.
Well, I have shown one test case which shows where lengths is a net
penalty. However, for that to be the case, you have to have the
following conditions *all* be true:
* lots of top-level keys
* short values
* rows which are on the borderline for TOAST
* table which fits in RAM
... so that's a "special case" and if it's sub-optimal, no bigee. Also,
it's not like it's an order-of-magnitude slower.
Anyway, I called for feedback on by blog, and have gotten some:
http://www.databasesoup.com/2014/08/the-great-jsonb-tradeoff.html
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com