Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id AF04B9FA3A0 for ; Wed, 25 Oct 2006 02:37:05 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 63999-05 for ; Wed, 25 Oct 2006 05:36:54 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from 66-226-76-106.dedicated.abac.net (66-226-76-106.dedicated.abac.net [66.226.76.106]) by postgresql.org (Postfix) with ESMTP id 07FE49FA5DC for ; Wed, 25 Oct 2006 02:36:53 -0300 (ADT) Received: (qmail 1583 invoked by uid 2020); 24 Oct 2006 22:38:26 -0700 Received: from wsip-70-167-125-69.sd.sd.cox.net (HELO ?192.168.0.3?) (70.167.125.69) by 66-226-76-106.dedicated.abac.net with (DHE-RSA-AES256-SHA encrypted) SMTP; 24 Oct 2006 22:38:26 -0700 Message-ID: <453EF7C4.2040105@modgraph-usa.com> Date: Tue, 24 Oct 2006 22:36:04 -0700 From: "Craig A. James" User-Agent: Thunderbird 1.5.0.7 (X11/20060909) MIME-Version: 1.0 To: "Jim C. Nasby" CC: Worky Workerson , Merlin Moncure , pgsql-performance@postgresql.org Subject: Re: Best COPY Performance References: <20061023215913.GW26892@nasby.net> <20061025001709.GA26892@nasby.net> In-Reply-To: <20061025001709.GA26892@nasby.net> 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=3.818 tagged_above=0 required=5 tests=HELO_DYNAMIC_IPADDR2 X-Spam-Level: *** X-Archive-Number: 200610/509 X-Sequence-Number: 21638 Jim C. Nasby wrote: > Well, given that perl is using an entire CPU, it sounds like you should > start looking either at ways to remove some of the overhead from perl, > or to split that perl into multiple processes. I use Perl for big database copies (usually with some processing/transformation along the way) and I've never seen 100% CPU usage except for brief periods, even when copying BLOBS and such. My typical copy divides operations into blocks, for example doing N = 0 while (more rows to go) { begin transaction select ... where primary_key > N order by primary_key limit 1000 while (fetch a row) insert into ... N = (highest value found in last block) commit } Doing it like this in Perl should keep Postgres busy, with Perl using only moderate resources. If you're seeing high Perl CPU usage, I'd look first at the Perl code. Craig