Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id B83C2B5DCE3 for ; Tue, 5 Jul 2011 14:41:21 -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 55264-01-2 for ; Tue, 5 Jul 2011 17:41:15 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.9]) by mail.postgresql.org (Postfix) with ESMTP id 7A478B5DC41 for ; Tue, 5 Jul 2011 14:41:04 -0300 (ADT) Received: from [192.168.1.7] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0Lpljf-1R9NdY2QDP-00fgb7; Tue, 05 Jul 2011 19:41:03 +0200 Message-ID: <4E134CAD.5010107@2ndQuadrant.com> Date: Tue, 05 Jul 2011 13:41:01 -0400 From: Greg Smith User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110505 Icedove/3.0.11 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Postgres bulkload without transaction logs References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:I1qSt4Q8BxnrAhdXQ04Qu1vDSQISGzWh0npNJOeRnoC 6dGiO0iUAoLp4xHFRLcy3h7Dx9Yxm7dJqiYlg38NOXT9f85OCN Bsq0hMP4JKeuWXYa34s4pvoqyieAuxAWR49rSMT04d/Hk1eoBi +JUug20mlmgNs8Gxv+H9AE/qHDopYL7msbd6JYfSGbRH1QpvM1 5a/RR+teYUfw99ozQZ1X4xrVq4BurBxama7z8hGKKY= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201107/15 X-Sequence-Number: 44227 On 07/05/2011 10:42 AM, shouvik basu wrote: > > I am trying to perform a bulkload of 1 crore rows using copy of row > width 1000, but the transaction logs keeps getting huge space, is > there a easy way to do it and avoid the transaction logs > If you're using the built-in streaming replication or an archive_command to replicate this data, you can't avoid the transaction logs; those are how the data gets shipped to the other server. If you CREATE or TRUNCATE the table you're loading data into as part of a transaction that loads into that, in a single server setup this will avoid creating the transaction log data. For example: BEGIN; TRUNCATE TABLE t; COPY t FROM ... COMMIT; That COPY will execute with minimal pg_xlog activity, because if the server crashes in the middle it will just roll back the table truncation. Another piece of software you may find useful for this case is http://pgbulkload.projects.postgresql.org/ -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD Comprehensive and Customized PostgreSQL Training Classes: http://www.2ndquadrant.us/postgresql-training/