Storage of Binary Data - Mailing list pgsql-sql

From Aaron Bono
Subject Storage of Binary Data
Date
Msg-id bf05e51c0607251005i58e836b7u51f411e103c242@mail.gmail.com
Whole thread Raw
Responses Re: Storage of Binary Data
List pgsql-sql
I have a somewhat philosophical question about best practices when storing binary data.<br /><br />For my web projects,
wehave been storing binary data (like images, PDF's, etc) on the hard drive of the web server instead of the database. 
Withinthe database, we keep information, like whether an image is present, in a separate column. <br /><br />For
example:<br/><br />CREATE TABLE site_user (<br />   site_user_id BIGSERIAL NOT NULL,<br />   has_profile_image BOOLEAN
DEFAULTfalse NOT NULL<br />   CONSTRAINT site_user_pkey PRIMARY KEY (site_user_id)<br />);<br /><br />And then store
theprofile image at: <br /><br />   [web root]/images/siteuserprofile/profile-[site_user_id here].jpg<br /><br />We
alsohave a back end process that then checks these files into CVS to help maintain version control.<br /><br />My
questionsare:<br />* What other options are people using to store data like this? <br />* What are the
advantages/disadvantagesof these storage methods?<br /><br />I have been very reluctant to store the binary data in the
databasefor the following reasons:<br />* Performance because you cannot just save the data to the file system, you
must<br />   interact with the database to get/save contents<br />* Increases complexity of application<br />* I have
hadproblems with saving binary data using JDBC before (that was with<br />   Oracle 7 though)<br clear="all" />* I am
concernedabout how well the data backups will work - there have been several <br />   people who have had problems with
backingup and restoring binary data on this<br />   list<br /><br />I am trying to develop some best practices so any
inputyou guys have is welcome!<br /><br />Thanks<br /><br
/>==================================================================<br />   Aaron Bono<br />   Aranya Software
Technologies,Inc.<br />   <a href="http://www.aranya.com">http://www.aranya.com</a><br
/>================================================================== 

pgsql-sql by date:

Previous
From: "Aaron Bono"
Date:
Subject: Re: About Div
Next
From: "Andrew Hammond"
Date:
Subject: Re: SQL generator