Received: from superfly.archi-me-des.de (unknown [62.8.212.177]) by postgresql.org (Postfix) with ESMTP id 26D7A476529 for ; Thu, 4 Apr 2002 05:32:35 -0500 (EST) Received: (from frank@localhost) by superfly.archi-me-des.de (8.9.3/8.9.3) id MAA30273; Thu, 4 Apr 2002 12:36:41 +0200 Date: Thu, 4 Apr 2002 12:36:41 +0200 From: Frank Joerdens To: Frank Joerdens Cc: Jean-Christophe FABRE , pgsql-sql@postgresql.org, linuxkurs@fas-art.com, adam@archi-me-des.de Subject: Re: bytea or large object Message-ID: <20020404123641.B30196@superfly.archi-me-des.de> References: <5.0.0.25.0.20020403164135.00ad0380@ensam.inra.fr> <20020404114051.A28343@superfly.archi-me-des.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.1.2i In-Reply-To: <20020404114051.A28343@superfly.archi-me-des.de>; from frank@joerdens.de on Thu, Apr 04, 2002 at 11:40:51AM +0200 X-Subliminal-Message: Use Linux! Use Linux! X-Archive-Number: 200204/49 X-Sequence-Number: 7314 On Thu, Apr 04, 2002 at 11:40:51AM +0200, Frank Joerdens wrote: > On Wed, Apr 03, 2002 at 04:47:29PM +0200, Jean-Christophe FABRE wrote: > > > > Hi, > > > > I would like to store .pdf files in a database, which is accessed through a > > PHP interface. > > which is the best way to store binary data? > > - bytea? (with the tricky handling of escape chars) > > - large objects? > > I asked the same question a week ago on pgsql-general. Here's my 2 > cents: The Postgres large object interface is older and therefore more > tried and tested. It used to have a reputation for slowness, but the > code was overhauled in 7.1 to address this issue. The LO interface is a > little convoluted and takes some getting used to, but works well. For > Bytea you can use "normal" SQL syntax. Escaping the data is not > really difficult. I forgot: A distinct advantage of bytea over large objects is that you can still use pg_dumpall to back up your entire server in a single step. It doesn't work with large objects because pg_dumpall can't create binary output in an e.g. tar file. This means that if you use large objects, you have to back up your databases one by one, using a binary output format with pg_dump. Regards, Frank