pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Sean Flaherty <sflaherty@grndwork.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Junwang Zhao <zhjwpku@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Increased storage size of jsonb in pg15
Date: Fri, 29 Dec 2023 08:43:29 -0800
Message-ID: <4bc54d39-1265-4a36-a7c5-4bf8682c4751@aklaver.com> (raw)
In-Reply-To: <CAOscTZOXVQGQeODrUNQ1Fqx862z1J0OXEmutJbHCiU6t8o_c4A@mail.gmail.com>
References: <CAOscTZMM5QvuXLUN5yE90w=dM+X=6saJR_1ABiOTtt+Y9G3KnQ@mail.gmail.com>
	<87680387-ed25-41ff-b6de-37e357398df9@aklaver.com>
	<CAOscTZPUcBzWoBqZobvaQ33F1JscsaabjMfi+DSZk07A8HqJPQ@mail.gmail.com>
	<ce378740-2da4-4bf4-a750-9556ae059c53@aklaver.com>
	<CAOscTZNAdqiS4kF1ESW5+6eUMtrzR6WyZXgtd0RUTkbramnk3Q@mail.gmail.com>
	<CAKFQuwb7z+y8ZmmMuTC6Kt+USNRGx2WutHt8QmgAw+MSPXKQcA@mail.gmail.com>
	<CAOscTZNUQmNborinfZtYSpUAwLnc7+LeoQzG_2R95Ro8kB=Xog@mail.gmail.com>
	<05dd34df-0fc3-4727-aedb-6232d1ccdd61@aklaver.com>
	<CAOscTZOZqeD++1Mznn0PAQvNvE-etfM6i1Up0LmoaRg-ONX6Kw@mail.gmail.com>
	<23b98884-10e6-4a2c-af8d-a0fad18c9f3c@aklaver.com>
	<CAOscTZP+rsXRF6b2m+v6oahgcsQ8s7ErZS-wiZdD7HA3boH7sA@mail.gmail.com>
	<e14f13f4-aef0-4698-9de9-0e27cf548b02@aklaver.com>
	<CAEG8a3KzuyZ=DEVUVvj7cy-9Z67=dY8BHwQ0gy=2zxzTWKxqpw@mail.gmail.com>
	<3049374.1703859779@sss.pgh.pa.us>
	<CAOscTZOXVQGQeODrUNQ1Fqx862z1J0OXEmutJbHCiU6t8o_c4A@mail.gmail.com>

On 12/29/23 07:21, Sean Flaherty wrote:
> What we found is that using lz4 compression on JSONB data is 20-25% 
> larger on disk than pglz.  We are running a production workload that is 
> storing jsonb data with a focus read performance.  The documented 
> increase in write speed wasn't a large benefit, however, the increase in 
> storage size moved the bulk of our data into TOAST and off the JSON 
> performance cliff ("2-10× slower queries") described by Evan 
> <https://www.evanjones.ca/postgres-large-json-performance.html> was 
> impactful.
> 
> This 
> <https://www.postgresql.fastware.com/blog/what-is-the-new-lz4-toast-compression-in-postgresql-14> ... does a nice job describing the differences between pglz and lz4 compression for different data but does not include json or jsonb.
> 
> I believe validation of our numbers and additional documentation on the 
> trade-offs in compression types would be very useful.

Yes, that would be useful.

Also per this:

"Working with AWS, we found that starting in RDS Postgres 15, the
default_toast_compression parameter is set to use lz4 compression 
instead of pglz."

there is a discussion to be had with AWS about the advisability of 
changing defaults without testing what that does to the end user or 
notifying the end user.


> 
> On Fri, Dec 29, 2023 at 7:23 AM Tom Lane <tgl@sss.pgh.pa.us 
> <mailto:tgl@sss.pgh.pa.us>> wrote:
> 
>     Junwang Zhao <zhjwpku@gmail.com <mailto:zhjwpku@gmail.com>> writes:
>      > On Fri, Dec 29, 2023 at 4:47 AM Adrian Klaver
>     <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
>      >> For what purpose? You are seeing differences in compression
>     strategies
>      >> between lz4 and pglz. The 'fix' would be to go back to pglz.
> 
>      > Agreed, lz4 is known for its high compression speed, but lower
>      > compression ratio, this is the trade off one should bear in mind.
> 
>     I don't know if we can make any blanket statements like that, but
>     if we can, shouldn't there be some advice in the manual?  AFAICS,
>     right now there's exactly zip about why you should choose one over
>     the other.
> 
>                              regards, tom lane
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com






view thread (18+ messages)  latest in thread

Message-ID: <4bc54d39-1265-4a36-a7c5-4bf8682c4751@aklaver.com>
Permalink:  ../4bc54d39-1265-4a36-a7c5-4bf8682c4751@aklaver.com/
Also on:    postgresql.org/message-id/4bc54d39-1265-4a36-a7c5-4bf8682c4751@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, sflaherty@grndwork.com, tgl@sss.pgh.pa.us, zhjwpku@gmail.com, david.g.johnston@gmail.com
  Subject: Re: Increased storage size of jsonb in pg15
  In-Reply-To: <4bc54d39-1265-4a36-a7c5-4bf8682c4751@aklaver.com>
  References: <CAOscTZMM5QvuXLUN5yE90w=dM+X=6saJR_1ABiOTtt+Y9G3KnQ@mail.gmail.com> <87680387-ed25-41ff-b6de-37e357398df9@aklaver.com> <CAOscTZPUcBzWoBqZobvaQ33F1JscsaabjMfi+DSZk07A8HqJPQ@mail.gmail.com> <ce378740-2da4-4bf4-a750-9556ae059c53@aklaver.com> <CAOscTZNAdqiS4kF1ESW5+6eUMtrzR6WyZXgtd0RUTkbramnk3Q@mail.gmail.com> <CAKFQuwb7z+y8ZmmMuTC6Kt+USNRGx2WutHt8QmgAw+MSPXKQcA@mail.gmail.com> <CAOscTZNUQmNborinfZtYSpUAwLnc7+LeoQzG_2R95Ro8kB=Xog@mail.gmail.com> <05dd34df-0fc3-4727-aedb-6232d1ccdd61@aklaver.com> <CAOscTZOZqeD++1Mznn0PAQvNvE-etfM6i1Up0LmoaRg-ONX6Kw@mail.gmail.com> <23b98884-10e6-4a2c-af8d-a0fad18c9f3c@aklaver.com> <CAOscTZP+rsXRF6b2m+v6oahgcsQ8s7ErZS-wiZdD7HA3boH7sA@mail.gmail.com> <e14f13f4-aef0-4698-9de9-0e27cf548b02@aklaver.com> <CAEG8a3KzuyZ=DEVUVvj7cy-9Z67=dY8BHwQ0gy=2zxzTWKxqpw@mail.gmail.com> <3049374.1703859779@sss.pgh.pa.us> <CAOscTZOXVQGQeODrUNQ1Fqx862z1J0OXEmutJbHCiU6t8o_c4A@mail.gmail.com> <4bc54d39-1265-4a36-a7c5-4bf8682c4751@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox