Understanding JSONB and TOAST tables

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Understanding JSONB and TOAST tables

Wells Oliver-2
Is there documentation that lays out how JSONB columns are stored? I have a Rather Large Table with 37m+ rows with large JSONB objects, its size is about 300mb, but there's an associated TOAST table with a 28GB size.

Curious how/why PSQL would store JSONB stuff this way.

Thanks!

--
Wells Oliver
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Understanding JSONB and TOAST tables

Peter Eisentraut-6
On 2020-06-09 21:48, Wells Oliver wrote:
> Is there documentation that lays out how JSONB columns are stored? I
> have a Rather Large Table with 37m+ rows with large JSONB objects, its
> size is about 300mb, but there's an associated TOAST table with a 28GB size.
>
> Curious how/why PSQL would store JSONB stuff this way.

TOAST is documented here:
https://www.postgresql.org/docs/current/storage-toast.html.  JSONB is
handled like any other (variable-size) data type.  You can use the
per-column storage settings mentioned on that page to perhaps achieve
different storage outcomes.

--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services