Postgresql – How to store LOB-image or PDF in Postgresql and what is the impact of having in Postgresql

performancepostgresqlpostgresql-9.6postgresql-performance

Please guide me to store LOB-image or PDF in Postgresql and let me know what is the impact of storing these types of objects on Postgresql database.

Any help will be appreciated.

Best Answer

BYTEA is a good choice here.

The BYTEA data type allows storage of binary strings.

It stores a LOB within the table, respectively using TOAST. It is thus limited to 1 GB The storage is octal and allows non printable characters (in contrast to character strings which don't). The input/output format is HEX (as of PostgreSQL 9.0). Notes:

BYTEA comes close to the SQL standard binary string type 'BLOB'. The functions and operators provided by BYTEA are mostly the same, while HEX input format of BYTEA is different. BYTEA is slower for lengths >20 MB than the LO facility (it has no random accees).

More details can be found here