Re: column type for pdf file - Mailing list pgsql-sql

From Craig Ringer
Subject Re: column type for pdf file
Date
Msg-id 4DD47D28.3070207@postnewspapers.com.au
Whole thread Raw
In response to Re: column type for pdf file  (Julien Cigar <jcigar@ulb.ac.be>)
Responses Re: column type for pdf file  (Piotr Czekalski <pczekalski@techbaza.pl>)
List pgsql-sql
On 05/19/2011 05:21 AM, Julien Cigar wrote:
> On 05/18/2011 23:00, Karsten Hilbert wrote:
>> On Wed, May 18, 2011 at 10:46:23PM +0200, Julien Cigar wrote:
>>
>>> Unless you've good reasons to do so it's best to store the file on
>>> the file system
>> Why ?
>>
>> If you suggest reasons are needed for storing the PDF in the
>> database I'd like to know the reasons for *not* doing so.
>>
>
> It increases the load, consume connections, but the biggest drawback is
> probably the memory consumption ..
>
> IMHO storing binary data in a database is almost always a bad idea .. it
> could be OK to store things like avatars, small icons, etc, but
> certainly not to store files of several MB ... file systems are done for
> that !

_however_, you lose transactional properties when doing this. You can 
land up with a file that's been added/updated where the associated 
transaction in the DB failed or rolled back. Very careful application 
programming and the use of 2 phase commit can provide reliable 
behaviour, but it's not trivial.

This is one area where I envy Microsoft. As they control the file system 
and the database, they've been able to come up with a really cool system 
where the file system integrates into database transactions, so you kind 
of get the best of both worlds. Very cool. If reiser4 hadn't gone the 
way of the dodo such a thing might've become possible on Linux, but I'm 
not aware of any other Linux file systems that safely support transactions.

--
Craig Ringer


pgsql-sql by date:

Previous
From: Craig Ringer
Date:
Subject: Re: client-side lo_import() provided by libpq ?
Next
From: Piotr Czekalski
Date:
Subject: Re: column type for pdf file