X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx2.hub.org [200.46.204.254]) by postgresql.org (Postfix) with ESMTP id 1865E11F7BBA for ; Thu, 20 Apr 2006 23:35:59 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: -2.445 X-Spam-Level: X-Spam-Status: No, score=-2.445 required=5 tests=[AWL=0.154, BAYES_00=-2.599] Received: from postgresql.org ([200.46.204.71]) by localhost (mx2.hub.org [200.46.204.254]) (amavisd-new, port 10024) with ESMTP id TnYxQbgNPH8I for ; Thu, 20 Apr 2006 23:35:58 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id D65FB11F7B45 for ; Thu, 20 Apr 2006 23:35:55 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id 4479556431; Thu, 20 Apr 2006 21:35:41 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Thu, 20 Apr 2006 21:35:41 -0500 Date: Thu, 20 Apr 2006 21:35:40 -0500 From: "Jim C. Nasby" To: Sriram Dandapani Cc: pgsql-admin@postgresql.org Subject: Re: slow cursor Message-ID: <20060421023540.GS49405@pervasive.com> References: <6992E470F12A444BB787B5C937B9D4DF0406A53A@ca-mail1.cis.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6992E470F12A444BB787B5C937B9D4DF0406A53A@ca-mail1.cis.local> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060421:sdandapani@counterpane.com::pjqpD0edNcEF7ii3:00000000000 0000000000000000000000000RQU X-Hashcash: 1:20:060421:pgsql-admin@postgresql.org::bE97XTfHGjihGHeh:00000000000 0000000000000000000000002MZ+ X-Archive-Number: 200604/208 X-Sequence-Number: 21377 On Mon, Apr 17, 2006 at 07:07:54AM -0700, Sriram Dandapani wrote: > I have a cursor that fetches 150K rows and updates or inserts a table > with 150K rows. > > It takes several minutes for the process to complete (about 15 minutes). > The select by itself (without cursor) gets all rows in 15 seconds. > > Is there a way to optimize the cursor to fetch all records and speed up > the process. I still need to do the record by record processing Not likely. Are you at least doing all this inside a transaction? -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461