Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 65BF0B5DC1F for ; Tue, 18 Oct 2011 21:56:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 43092-10 for ; Wed, 19 Oct 2011 00:56:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com [209.85.216.181]) by mail.postgresql.org (Postfix) with ESMTP id D2E8AB5DC04 for ; Tue, 18 Oct 2011 21:56:48 -0300 (ADT) Received: by qyk27 with SMTP id 27so1173175qyk.19 for ; Tue, 18 Oct 2011 17:56:48 -0700 (PDT) Received: by 10.229.65.18 with SMTP id g18mr1004811qci.22.1318985808029; Tue, 18 Oct 2011 17:56:48 -0700 (PDT) Received: from ayaki.localdomain (58-7-161-39.dyn.iinet.net.au. [58.7.161.39]) by mx.google.com with ESMTPS id cb11sm4603197qab.3.2011.10.18.17.56.46 (version=SSLv3 cipher=OTHER); Tue, 18 Oct 2011 17:56:47 -0700 (PDT) Message-ID: <4E9E204B.2040608@ringerc.id.au> Date: Wed, 19 Oct 2011 08:56:43 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Heavy contgnous load References: <1318939765661-4913425.post@n5.nabble.com> In-Reply-To: <1318939765661-4913425.post@n5.nabble.com> 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=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201110/156 X-Sequence-Number: 45378 On 10/18/2011 08:09 PM, kzsolt wrote: > What is important think for this task I do not need any tranasction. So the > COMMIT and ROLLBACK feature is useless. > The question is how I minimize the rollback activity to free resoureces? Actually, you do need transactions, because they're what prevents your database from being corrupted or left in a half-updated state if/when the database server loses power, crashes, etc. Presumably when you say "rollback activity" you mean the overheads involved in supporting transactional, atomic updates? If so, there isn't much you can do in an INSERT-only database except try to have as few indexes as possible and do your inserts inside transactions in batches, rather than one-by-one as individual statements. Consider logging to a flat file to accumulate data, then COPYing data in batches into PostgreSQL. An alternative would be to write your data to an unlogged table (PostgreSQL 9.1+ only) then `INSERT INTO ... SELECT ...' it into the main table(s) in batches. Unlogged tables avoid most of the overheads of the write-ahead log crash safety, but they do that by NOT BEING CRASH SAFE. If your server, or the PostgreSQL process, crashes then unlogged tables will be ERASED. If you can afford to lose a little data in this case, you can use unlogged tables as a staging area. -- Craig Ringer