Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 72423B5DBC6 for ; Tue, 23 Aug 2011 17:40: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 50368-07 for ; Tue, 23 Aug 2011 20:40:52 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outbound.afilias.info (outbound.afilias.info [69.46.124.26]) by mail.postgresql.org (Postfix) with ESMTP id 1C168B5D803 for ; Tue, 23 Aug 2011 17:40:51 -0300 (ADT) Received: from ms6.yyz2.afilias-ops.info ([10.50.129.112] helo=smtp.afilias.info) by outbound.afilias.info with esmtp (Exim 4.69) (envelope-from ) id 1QvxmE-0001Er-8V for pgsql-hackers@postgresql.org; Tue, 23 Aug 2011 20:40:50 +0000 Received: from mail-ew0-f50.google.com ([209.85.215.50]) by smtp.afilias.info with esmtps (TLSv1:RC4-SHA:128) (Exim 4.72) (envelope-from ) id 1QvxmE-0005Zw-7e for pgsql-hackers@postgresql.org; Tue, 23 Aug 2011 20:40:50 +0000 Received: by ewy10 with SMTP id 10so234728ewy.9 for ; Tue, 23 Aug 2011 13:40:49 -0700 (PDT) Received: by 10.14.145.67 with SMTP id o43mr1314709eej.21.1314132049006; Tue, 23 Aug 2011 13:40:49 -0700 (PDT) Received: from [10.10.46.23] (tor-gateway.afilias.info [199.15.87.4]) by mx.google.com with ESMTPS id 17sm216658eex.55.2011.08.23.13.40.45 (version=SSLv3 cipher=OTHER); Tue, 23 Aug 2011 13:40:48 -0700 (PDT) Message-ID: <4E54104B.107@ca.afilias.info> Date: Tue, 23 Aug 2011 16:40:43 -0400 From: Steve Singer User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 MIME-Version: 1.0 To: Tom Lane CC: Robert Haas , PostgreSQL-development Hackers Subject: Re: skip WAL on COPY patch References: <4E53E7D5.6030808@ca.afilias.info> <1739.1314126320@sss.pgh.pa.us> <3073.1314130656@sss.pgh.pa.us> In-Reply-To: <3073.1314130656@sss.pgh.pa.us> 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=-2.405 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.505 X-Spam-Level: X-Archive-Number: 201108/1071 X-Sequence-Number: 193826 On 11-08-23 04:17 PM, Tom Lane wrote: > Robert Haas writes: >> What I think would be really interesting is a way to make this work >> when the table *isn't* empty. In other words, have a COPY option that >> (1) takes an exclusive lock on the table, (2) writes the data being >> inserted into new pages beyond the old EOF, and (3) arranges for crash >> recovery or transaction abort to truncate the table back to its >> previous length. Then you could do fast bulk loads even into a table >> that's already populated, so long as you don't mind that the table >> will be excusive-locked and freespace within existing heap pages won't >> be reused. > > What are you going to do with the table's indexes? > > regards, tom lane > What about not updating the indexes during the copy operation then to an automatic rebuild of the indexes after the copy (but during the same transaction). If your only adding a few rows to a large table this wouldn't be what you want, but if your only adding a few rows then a small amount of WAL isn't a big concern either.