Re: Database versus filesystem for storing images - Mailing list pgsql-general

From Jeremy Haile
Subject Re: Database versus filesystem for storing images
Date
Msg-id 1168038441.20812.283358879@webmail.messagingengine.com
Whole thread Raw
In response to Re: Database versus filesystem for storing images  (Jorge Godoy <jgodoy@gmail.com>)
List pgsql-general
Referential integrity would be one positive for storing the files in the
database.  I wasn't responding to that.  I'm simply saying that browsing
them with third-party tools, updating, compressing/archiving, etc. is
easier if they are not in the database.  Those are all actions that I've
found useful on other projects when storing user-uploaded images.

Depending upon the number of images on disk, it might not be hard to
verify that all the images referenced from the DB are there.  You could
have a small program that steps through each record and verifies its
existence on disk.  That could easily be run after a restore or as a
batch-process.  If you're talking about trillions of images - sure
that'd be tough.  If these images are extremely important - maybe that
solution is unacceptable.  But this is just a case of too little
information to make a decision.

There are pros and cons to both approach - in every project I've worked
on that faced this decision, I felt the pros of storing it in the file
system outweighed the pros of storing it in the DB.  But there is no
right or wrong answer to the question (unless of course you had special
circumstances that made one option clearly superior - but I don't think
we know enough details to make that call)

My two cents,
Jeremy Haile

On Fri, 05 Jan 2007 20:24:05 -0200, "Jorge Godoy" <jgodoy@gmail.com>
said:
> "Jeremy Haile" <jhaile@fastmail.fm> writes:
>
> > Another thing to consider is that storing them in the file system makes
> > it much easier to browse the images using third-party tools, update
> > them, archive them (by gzipping or whatever).  This is much more
> > difficult if they are stored in the database.
>
> If you touch the files with third-party tools how are you going to
> prevent
> that they aren't missing when the database say they are there?  If you're
> referencing them somehow, you have to guarantee that they are there...
> Or am
> I the only one that is thinking about referential integrity with those
> files?
>
> --
> Jorge Godoy      <jgodoy@gmail.com>

pgsql-general by date:

Previous
From: Curran Schiefelbein
Date:
Subject: configure; make on cygwin doesn't produce DLLs
Next
From: "Angva"
Date:
Subject: upgrading and pg_restore versions