How to store videos in a PostgreSQL database?

16,053

Solution 1

I would generally not recommend to store huge blobs (binary large objects) inside PostgreSQL if referential integrity is not your paramount requirement. Storing huge files in the filesystem is much more efficient:
Much faster, less disk space used, easier backups.

I have written a more comprehensive assessment of the options you've got in a previous answer to a similar question. (With deep links to the manual.)

Solution 2

We did some tests about practical limits of bytea datatype. There are theoretical limit 1GB. But practical limit is about 20MB. Processing larger bytea data eats too much RAM and encoding and decoding takes some time too. Personally I don't think so storing videos is good idea, but if you need it, then use a large objects - blobs.

Share:
16,053
sat
Author by

sat

About Me: Operation not permitted

Updated on July 28, 2022

Comments

  • sat
    sat almost 2 years

    I am storing image files (like jpg, png) in a PostgreSQL database. I found information on how to do that here.

    Likewise, I want to store videos in a PostgreSQL database. I searched the net - some say one should use a data type such as bytea to store binary data.

    Can you tell me how to use a bytea column to store videos?