As for PostgreSQL , enter text out of the question. It is slower, uses more space and more error prone than bytea for this purpose.
There are basically 3 approaches:
Each has its own advantages and disadvantages.
quite easy to handle, but it needs more disk space. Some decoding and coding is required, which makes it also slow. Backups are growing fast!
a little inconvenient in processing, but you have your own infrastructure for manipulating blobs - if you need it. And you can easily make separate backups.
is the fastest way and uses the least disk space. But it does not provide the referential integrity that you get when you store in the database.
I have a number of implementations for image files: save a small sketch in a byte field for referential integrity and quick reference. Save the original image as a file in the file system. Of course, you need to think about when and how to delete obsolete files, how to back up external files, etc.
Erwin brandstetter
source share