1

I am running PostgreSQL version 9.6.13. I have 2 questions

  1. What is the max storage range/size of datatype 'jsonb' and 'text'
  2. How to find max storage range/size for other fields?

I looked into 'pg_type' catalog table that PostgreSQL provides. For both 'text' and 'jsonb' datatype the field typlen=-1 which means that they are variable length type, but nowhere can I find the max storage size for both.

1 Answer 1

1

There are more limit's than one:

  1. There is theoretical limit 1GB specified by TOAST storage.

  2. But practical limit is significantly lower - processing is memory extensive, and for long values there can be problems with free memory. There can be performance problems too - jsonb is immutable atomic value - every update generate complete new value, every reads have to read complete value. If your values are less than 200MB, then you don't have a problems usually.

  3. A database server should to not use swap intensively. That means so real limit depends on number of active queries (active users). Higher max_connection means lower practical limit for large values.

Types with typlen == -1 are varlena types. You can find maximal size in documentation. But, again, this is theoretical limit. Practical limits are lower and depends on available memory for Postgres and probably structure (properties) of stored objects. You have to test it. There are not any other methods.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.