Re: column type for pdf file

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Julien Cigar <jcigar(at)ulb(dot)ac(dot)be>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: column type for pdf file
Date: 2011-05-19 02:15:04
Message-ID: 4DD47D28.3070207@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Piotr Czekalski 2011-05-19 06:00:11 Re: column type for pdf file
Previous Message Craig Ringer 2011-05-19 02:02:53 Re: client-side lo_import() provided by libpq ?