Re: jsonb format is pessimal for toast compression

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, Peter Geoghegan <pg(at)heroku(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Stephen Frost <sfrost(at)snowman(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Kevin Grittner <kgrittn(at)ymail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Larry White <ljw1001(at)gmail(dot)com>
Subject: Re: jsonb format is pessimal for toast compression
Date: 2014-08-14 23:47:32
Message-ID: 53ED4A94.7000606@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> What's more, it looks like the jsonb data is pretty much never getting
> compressed --- the min is too high for that. So I'm guessing that this
> example is mostly about the first_success_by threshold preventing any
> compression from happening. Please, before looking at my other patch,
> try this: in src/backend/utils/adt/pg_lzcompress.c, change line 221
> thusly:
>
> - 1024, /* Give up if no compression in the first 1KB */
> + INT_MAX, /* Give up if no compression in the first 1KB */
>
> then reload the jsonb data and give us the same stats on that.

That helped things, but not as much as you'd think:

postgres=# select pg_size_pretty(pg_total_relation_size('jsonic'));

pg_size_pretty
----------------
394 MB
(1 row)

postgres=# select pg_size_pretty(pg_total_relation_size('jsonbish'));
pg_size_pretty
----------------
801 MB
(1 row)

What I find really strange is that the column size distribution is
exactly the same:

thetype | colsize_distribution
---------+----------------------------
json | {1777,1803,1890,1940,4424}
jsonb | {5902,5926,5978,6002,6208}

Shouldn't the lower end stuff be smaller?

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2014-08-15 00:06:10 Re: jsonb format is pessimal for toast compression
Previous Message Tomas Vondra 2014-08-14 23:38:38 Re: 9.5: Memory-bounded HashAgg