Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 0DB71B5DC0E; Fri, 27 May 2011 14:09:58 -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 72926-07; Fri, 27 May 2011 17:09:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 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 49E28B5DBF6; Fri, 27 May 2011 14:09:50 -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 p4RGCgka021708; Fri, 27 May 2011 12:12:42 -0400 Message-ID: <4DDFCD7A.8030902@encs.concordia.ca> Date: Fri, 27 May 2011 12:12:42 -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: Jasen Betts CC: pgsql-general@postgresql.org, PostgreSQL SQL List Subject: 500KB PDF files for postgresql8.3, which is the most efficient way? References: <482E80323A35A54498B8B70FF2B87980049413B5EB@azsmsx504.amr.corp.intel.com> <482E80323A35A54498B8B70FF2B87980049413B673@azsmsx504.amr.corp.intel.com> <4DDEC3B1.2050008@boscorama.com> In-Reply-To: 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/27 12:12:42 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/870 X-Sequence-Number: 176302 Hello, I'd like to have more comments about the following case: . 500KB per PDF file; 30 files per year . PSQL8.3 Solution: ==================== (1) Save pdfs to file system, only point file name in psql8.3 (2) Save oids of pdfs into table (3) Save pdf files as bytea column in psql8.3 Pros and cons for (1), (2), (3), which is the most efficient way? Thanks a lot! Emi On 05/27/2011 12:45 AM, Jasen Betts wrote: > On 2011-05-26, Bosco Rama wrote: > >> select * into temp table foo from maintable where primcol=123; >> update foo set primcol = 456; >> insert into maintable select * from foo; >> >> You also may need this is if you intend to use the same sequence of >> calls on within the same session: >> >> drop table foo; > > Yet another way to do the same thing: > > begin; > > create temportary table foo on commit drop as > select * from maintable where primcol=123; > update foo, set primcol=456; > insert into maintable select * from foo; > > commit; >