Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 071D69FB698 for ; Fri, 16 Mar 2007 11:00:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 01112-04 for ; Fri, 16 Mar 2007 10:59:43 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 85A269FB64B for ; Fri, 16 Mar 2007 10:59:53 -0300 (ADT) Received: from [192.168.1.50] (or-67-76-146-141.sta.embarqhsd.net [67.76.146.141]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l2GDxqE5019204 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 16 Mar 2007 06:59:52 -0700 Message-ID: <45FAA30F.4090401@commandprompt.com> Date: Fri, 16 Mar 2007 07:00:47 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Thunderbird 1.5.0.9 (X11/20070103) MIME-Version: 1.0 To: femski CC: pgsql-performance@postgresql.org Subject: Re: Postgres batch write very slow - what to do References: <9452092.post@talk.nabble.com> In-Reply-To: <9452092.post@talk.nabble.com> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV version 0.88.5, clamav-milter version 0.88.5 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Fri, 16 Mar 2007 06:59:53 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/256 X-Sequence-Number: 23661 femski wrote: > Folks ! > > I have a batch application that writes approx. 4 million rows into a narrow > table. I am using JDBC addBatch/ExecuteBatch with auto commit turned off. > Batch size is 100. So far I am seeing Postgres take roughly five times the > time it takes to do this in the Oracle. If you are using 8.2 could you try with the multi value inserts? insert into foo(bar) values (bang) (bong) (bing) ...? > > I have played with many parameters. Only one that seems to have any affect > is fsync - but thats only 10% or so. > Initially I got the warning that checkpoints were happening too often so I > increased the segments to 24. Warnings stopped, but no real improvement in > performance. > > Is postgres really that slow ? What am I missing ? > > Here are the changes to my postgressql.cong file. > > shared_buffers = 768MB > work_mem = 256MB > maintenance_work_mem = 128MB > fsync = off > > checkpoint_segments = 24 > autovacuum = on > > Thank you, > > -Sanjay -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Providing the most comprehensive PostgreSQL solutions since 1997 http://www.commandprompt.com/ Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate PostgreSQL Replication: http://www.commandprompt.com/products/