Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 08A7D9FB32C for ; Wed, 14 Mar 2007 23:26:26 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 83046-01 for ; Wed, 14 Mar 2007 23:26:21 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by postgresql.org (Postfix) with ESMTP id ED0CD9FB228 for ; Wed, 14 Mar 2007 23:26:21 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id k3so132765ugf for ; Wed, 14 Mar 2007 19:26:20 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ofps39ANmUjK8Cfs/Ch65vZvf7ZDqcMnUsgRu2wEgarNfHgGfJjCJZEem9gsvMsFWeOuvuxhsQFhsXyUZQ0f1BiahAzcXAKHLwZuvcgaBsbaY6S0MLbBCPTUfrFIGKWrtytGg4x9hzORldxwEoQoa2jiiRitEYvAptnPhYQ03lU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=BIYzMArTOuQ5qogSGVA18iB/RoDJtowLObe38Y+rRcpgF9HyjM7Zce9/VBx9fk+LWaBhvy+ZZWa6omqMjyjdFKmTZovAkuBptVugb+YySIkT4ukKiu5dhpw03fOizDfzj1dQhgh0/vZVgC5Gi/UPmkw3q11h/4cbjq0qTkob3Jk= Received: by 10.78.18.3 with SMTP id 3mr49853hur.1173925580192; Wed, 14 Mar 2007 19:26:20 -0700 (PDT) Received: by 10.78.35.18 with HTTP; Wed, 14 Mar 2007 19:26:20 -0700 (PDT) Message-ID: Date: Thu, 15 Mar 2007 07:56:20 +0530 From: "Merlin Moncure" To: femski Subject: Re: Postgres batch write very slow - what to do Cc: pgsql-performance@postgresql.org In-Reply-To: <9486986.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <9452092.post@talk.nabble.com> <45F685B7.5040001@enterprisedb.com> <9453712.post@talk.nabble.com> <9473692.post@talk.nabble.com> <9486986.post@talk.nabble.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/242 X-Sequence-Number: 23647 On 3/15/07, femski wrote: > > I am using Oracle XE so its using only one core and doing just fine. > How do I split backend to 4+ processes ? > I don't want to write a multithreaded loader app. > And I didn't think Postgres can utilize multiple cores for the > same insert statement. well, what sql is the jdbc driver creating exactly? It is probably running inserts in a transaction. your load is about 17k inserts/sec which about right for postgres on your hardware. you have the following options to play increase insert performance: * tweak postgresql.conf fsync: off it is not already wal_segments: bump to at least 24 or so maintenance_work_mem: if you create key after insert, bump this high (it speeds create index) bgwriter settings: you can play with these, try disabling bgwriter first (maxpages=0) full_page_writes=off might help, not 100% sure about this * distribute load make load app multi thrreaded. * use copy for bulk load [is there a way to make jdbc driver do this?] * use multi-line inserts (at least 10 rows/insert)...nearly as fast as copy * if jdbc driver is not already doing so, prepare your statements and execute. merlin