David
David

Reputation: 181

How much data can practically be stored in a Postgres table field?

I have an application that stores data in a Postgres database that I am considering extending. This would entail storing larger amounts of data in fields of a table. How large can the data in a field reasonably be before one starts running into performance issues? 100kb? 1mb? 100mb? 500mb? Does it matter what type the data is stored as (other than the fact the binary data tends to be more compact)?

Upvotes: 2

Views: 7495

Answers (1)

Erwin Brandstetter
Erwin Brandstetter

Reputation: 656391

Up to 1 GB per field, 32 TB per relation.

Upper limits are as defined in the "about" page of Postgres.
... have since been moved to the manual page "PostgreSQL Limits".

But storing massive amounts of data in table columns is typically a bad idea. If you want to change anything in a 1 GB field, Postgres has to write a new row version, which is extremely inefficient. That's not the use case relational databases are optimized for.

Consider storing large objects in files or at least use binary large objects for this. See:

I would think twice before even storing megabytes of data into a single table field. You can do it. Doesn't mean you should.

Upvotes: 3

Related Questions