Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 05D259FC87F for ; Thu, 25 Oct 2007 13:10:01 -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 56898-02-2 for ; Thu, 25 Oct 2007 13:09:45 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by postgresql.org (Postfix) with ESMTP id 1D28C9FCB6A for ; Thu, 25 Oct 2007 13:07:23 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id j3so555387ugf for ; Thu, 25 Oct 2007 09:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=MyXoUk2/TIT/RXxSt6Dsyju+6R8HhL9qg7edAec5fa0=; b=BQo/HlQ2PoL/F7tgBBhU8jpluvmAOg+X76TXX8Zha4OSMQ61ZUzQ1tqcOWG/9NTo1NHu5EYtVavySJL7QxOitozJMCPQtrkM/Bxsa83O+BDyRJUP9Cf3W9sefH0JsPUPEz0MvzaBvWERmXN4wQJ4b8BtCHfRrkuiF7NvepB9XZg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=pmovPMU3vgBoQW+pPWZJ/Z2BRA/Hhj/TufEtKPmd21ok3qbSJiIGzn+gOo4m/ciUP+/jTv6AZNowOOkAg865FJpy6yd6vNQbELcp8FQcIx6MoPTPxvgQ21EHdqLaAUKaRBEpcoj774QM2h3faDmHLtaktg782/IhS/1Ofi3VZhg= Received: by 10.66.222.9 with SMTP id u9mr39238ugg.1193328442100; Thu, 25 Oct 2007 09:07:22 -0700 (PDT) Received: from ?172.24.32.184? ( [62.232.55.118]) by mx.google.com with ESMTPS id c25sm2792710ika.2007.10.25.09.07.19 (version=SSLv3 cipher=RC4-MD5); Thu, 25 Oct 2007 09:07:20 -0700 (PDT) Message-ID: <4720BEF3.9000802@enterprisedb.com> Date: Thu, 25 Oct 2007 17:06:11 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.12 (X11/20070730) MIME-Version: 1.0 To: Jean-David Beyer CC: pgsql-performance@postgresql.org Subject: Re: Bunching "transactions" References: <4720B680.5060407@verizon.net> In-Reply-To: <4720B680.5060407@verizon.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/281 X-Sequence-Number: 27303 Jean-David Beyer wrote: > 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. Using the small transactions, you were limited by the speed your hard disk flush the commit WAL records to the disk. With small transactions like that, it's not about the bandwidth, but latency of the hard drive. Using larger transactions helps because you get more work done on each disk operation. Upcoming 8.3 release will have a feature called "asynchronous commit", which should speed up those small transactions dramatically, if you don't want to batch them into larger transactions like you did: http://www.postgresql.org/docs/8.3/static/runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT > 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? Well, you have to do the I/O eventually, regardless of shared_buffers. Common wisdom is that increasing wal_buffers from the default helps with bulk loading like that, up to a point. Increasing checkpoint_segments helps as well. After you've done all that, you're going to be limited by either the bandwidth of your I/O system, or the speed of your CPU, depending on your hardware. Using COPY instead of INSERTs will help if it's CPU. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com