Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id A609CB5DBEA for ; Wed, 18 May 2011 23:15:20 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 94090-07 for ; Thu, 19 May 2011 02:15:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [173.230.139.50]) by mail.postgresql.org (Postfix) with ESMTP id D37A6B5DBE7 for ; Wed, 18 May 2011 23:15:13 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by www.postnewspapers.com.au (Postfix) with ESMTP id E21A64B9; Wed, 18 May 2011 22:15:13 -0400 (EDT) X-Virus-Scanned: amavisd-new at postnewspapers.com.au.com Received: from www.postnewspapers.com.au ([127.0.0.1]) by localhost (www.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id MU1pR9YQrN9a; Wed, 18 May 2011 22:15:13 -0400 (EDT) Received: from mail.postnewspapers.com.au (ppp171-128.static.internode.on.net [150.101.171.128]) by www.postnewspapers.com.au (Postfix) with ESMTP id E21A027; Wed, 18 May 2011 22:15:12 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id D6867AF0F1; Thu, 19 May 2011 10:15:11 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id if5WTtn37cPi; Thu, 19 May 2011 10:15:07 +0800 (WST) Received: from [10.1.1.5] (124-169-254-58.dyn.iinet.net.au [124.169.254.58]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id C070FAE4A6; Thu, 19 May 2011 10:15:06 +0800 (WST) Message-ID: <4DD47D28.3070207@postnewspapers.com.au> Date: Thu, 19 May 2011 10:15:04 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10 MIME-Version: 1.0 To: Julien Cigar CC: pgsql-sql@postgresql.org Subject: Re: column type for pdf file References: <4DD42A1C.30202@encs.concordia.ca> <4DD4301F.4010403@ulb.ac.be> <20110518210041.GF2498@hermes.hilbert.loc> <4DD43867.2040709@ulb.ac.be> In-Reply-To: <4DD43867.2040709@ulb.ac.be> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201105/113 X-Sequence-Number: 35397 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