Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id CCEB3B5DBE6 for ; Thu, 19 May 2011 10:40:07 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 97818-04 for ; Thu, 19 May 2011 13:40:00 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from oldperseverance.encs.concordia.ca (oldperseverance.encs.concordia.ca [132.205.96.94]) by mail.postgresql.org (Postfix) with ESMTP id 1D915B5DBDC for ; Thu, 19 May 2011 10:39:59 -0300 (ADT) Received: from cacao.encs.concordia.ca (emilu@cacao.encs.concordia.ca [132.205.47.225]) by oldperseverance.encs.concordia.ca (envelope-from emilu@encs.concordia.ca) (8.13.7/8.13.7) with ESMTP id p4JDdsYq027292; Thu, 19 May 2011 09:39:54 -0400 Message-ID: <4DD51DAA.4010706@encs.concordia.ca> Date: Thu, 19 May 2011 09:39:54 -0400 From: Emi Lu Reply-To: emilu@encs.concordia.ca User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20101125 Lightning/1.0b1 Thunderbird/3.0.11 MIME-Version: 1.0 To: pgsql-sql@postgresql.org CC: jcigar@ulb.ac.be, Karsten.Hilbert@gmx.net, eldin00@gmail.com 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> <4DD47D28.3070207@postnewspapers.com.au> <4DD4B1EB.50202@techbaza.pl> In-Reply-To: <4DD4B1EB.50202@techbaza.pl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on oldperseverance.encs.concordia.ca at 2011/05/19 09:39:54 EDT 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/116 X-Sequence-Number: 35400 Hello all, All right, it seems that everyone thinks saving a pdf into postgresql is not a good idea. My situation is: ===================== . pdf file: 500kb . One year I need to save around 65 files = 32M As a summary, disadvantages are: ================================== . Memory issue when read/save/retrieve the file . Consume connections . Increase load . during transaction lo may be lost? . file systems do better than DB . storing a reference to a file stored outside the database is preferable If I miss anything, please add them. I am curious, for what circumstances, should the lo be used in postgresql? Thanks a lot! Emi On 05/19/2011 02:00 AM, Piotr Czekalski wrote: > Right! > The external binary file storage has another advantage (that may be > considered as disadvantage as well) - it is usually easier to develop > and test mechanism as you're able to browse uploaded file result using > os / application or even "exchange" file contents for test purposes, > while in case of iternal storage you need some extra code to do it for > you and you newer know, if it works well. Another problem is caching / > feeding files in case of heavy load condition - caching of huge objects > is problematic while you never know the dimension of the problem, > non-caching approach may cause bottlenecks on frequent database reads. > I was considering both scenarios and finally've choosen external storage > for our invoice generation system. > > Regards, > > Piotr > > -- Emi Lu, ENCS, Concordia University, Montreal H3G 1M8 emilu@encs.concordia.ca +1 514 848-2424 x5884