Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id A09489FC94C for ; Thu, 25 Oct 2007 12:40:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 47789-03-4 for ; Thu, 25 Oct 2007 12:39:53 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) by postgresql.org (Postfix) with ESMTP id 1C4279FC9FF for ; Thu, 25 Oct 2007 12:36:15 -0300 (ADT) Received: from [192.168.0.251] ([71.251.196.74]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JQH00F0F4E87WY3@vms040.mailsrvcs.net> for pgsql-performance@postgresql.org; Thu, 25 Oct 2007 10:30:08 -0500 (CDT) Date: Thu, 25 Oct 2007 11:30:08 -0400 From: Jean-David Beyer Subject: Bunching "transactions" To: pgsql-performance@postgresql.org Message-id: <4720B680.5060407@verizon.net> Organization: Institute for Regimented Whimsey MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Enigmail-Version: 0.94.0.0 User-Agent: Thunderbird 1.5.0.9 (X11/20070317) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/279 X-Sequence-Number: 27301 I have just changed around some programs that ran too slowly (too much time in io-wait) and they speeded up greatly. This was not unexpected, but I wonder about the limitations. By transaction, I mean a single INSERT or a few related INSERTs. What I used to do is roughly like this: for each file { for each record { BEGIN WORK; INSERT stuff in table(s); if error { ROLLBACK WORK } else { COMMIT WORK; } } } The speedup was the obvious one: for each file { BEGIN WORK; for each record { INSERT stuff in table(s); } if error { ROLLBACK WORK } else { COMMIT WORK; } } This means, of course, that the things I think of as transactions have been bunched into a much smaller number of what postgreSQL thinks of as large transactions, since there is only one per file rather than one per record. Now if a file has several thousand records, this seems to work out just great. But what is the limitation on such a thing? In this case, I am just populating the database and there are no other users at such a time. I am willing to lose the whole insert of a file if something goes wrong -- I would fix whatever went wrong and start over anyway. But at some point, disk IO would have to be done. Is this just a function of how big /pgsql/data/postgresql.conf's shared_buffers is set to? Or does it have to do with wal_buffers and checkpoint_segments? -- .~. Jean-David Beyer Registered Linux User 85642. /V\ PGP-Key: 9A2FC99A Registered Machine 241939. /( )\ Shrewsbury, New Jersey http://counter.li.org ^^-^^ 11:10:01 up 2 days, 3:28, 4 users, load average: 5.76, 5.70, 5.53