Re: Where to store Blobs? - Mailing list pgsql-general

From Tim Cross
Subject Re: Where to store Blobs?
Date
Msg-id 87mulyo4sh.fsf@gmail.com
Whole thread Raw
In response to Where to store Blobs?  (Thomas Güttler <guettliml@thomas-guettler.de>)
Responses Re: Where to store Blobs?  (Jamesie Pic <jpic@yourlabs.org>)
List pgsql-general
I don't think there is a suitable 'one size fits all' answer to this
question. A lot will depend on how you intend to use the blobs and what
sort of hardware architecture, especially storage systems, you have.

At first glance, sticking everything in the DB seems like an easy
choice. However, that can result in very large databases, which in turn
can lead to issues with respect to backup, replication etc. If all your
after is storage, then sometimes your better off using the file system
for the blobs and keeping the metadata in the db. It can potentially be
faster and easier to serve up blobs from the file system compared to the
db if that is the main use case, but if the blobs are more dynamic or
you use collections of blobs to build a master blob etc, the db has some
advantages.

If you really need database like functionality, given the relative
cheapness of storage and the wealth of options available, storing the
blobs in the database can have advantage. However, it will be important
to select the most appropriate datatype. What some people think of as a
'blob' is just an array of bytes to many DBs and as usual, you need to
make the decision as to what is the best storage representation for your
requirements, keeping in mind that the more general 'blob' like storage
type you choose often represents a loss in functionality but an increase
in flexibility wrt to what can be inserted over more precise data types,
which will be more restrictive about what can be inserted, but offer
more functionality regarding what you can do with it (at the db level).

Tim


Thomas Güttler <guettliml@thomas-guettler.de> writes:

> Some days ago I asked "Where **not** to use PostgreSQL?" on this mailing list.
>
> Now I realized: Nobody talked about Blobs.
>
> I guess most people do not store Blobs in PostgresSQL.
>
> Where do you store Blobs?
>
> (In my case Blobs are PDF/image files with size up to 20 MByte.
> I do not talk about very big blobs which are several hundret MByte)


--
Tim Cross


pgsql-general by date:

Previous
From: Benedict Holland
Date:
Subject: Re: Where to store Blobs?
Next
From: Rene Romero Benavides
Date:
Subject: Re: PostgreSQL temp table blues