X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id A685611F949C for ; Mon, 24 Apr 2006 15:21:40 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 54718-03-2 for ; Mon, 24 Apr 2006 15:21:05 -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 D8CFC11F8BD4 for ; Mon, 24 Apr 2006 14:42:31 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id 30DD656423; Mon, 24 Apr 2006 12:42:30 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Mon, 24 Apr 2006 12:42:29 -0500 Date: Mon, 24 Apr 2006 12:42:29 -0500 From: "Jim C. Nasby" To: Sriram Dandapani Cc: pgsql-admin@postgresql.org Subject: Re: slow cursor Message-ID: <20060424174229.GE48010@pervasive.com> References: <6992E470F12A444BB787B5C937B9D4DF0406AD88@ca-mail1.cis.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6992E470F12A444BB787B5C937B9D4DF0406AD88@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:060424:sdandapani@counterpane.com::TeTQv63C9ENOtBDf:00000000000 0000000000000000000000003o3P X-Hashcash: 1:20:060424:pgsql-admin@postgresql.org::q6v6jYnFGiitGUsN:00000000000 0000000000000000000000006DEF X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/245 X-Sequence-Number: 21414 Ok, so why does that require row-by-row processing? On Thu, Apr 20, 2006 at 08:45:57PM -0700, Sriram Dandapani wrote: > Yes..all of it is in one transaction as there is a window of record ids > that need to be processed in 1 transaction. Data inflow is very > voluminous appx 1 million every 15 minutes and the goal is to create > aggregate tables on the fly (the alternative is to use nightly > aggregates). > > -----Original Message----- > From: Jim C. Nasby [mailto:jnasby@pervasive.com] > Sent: Thursday, April 20, 2006 7:36 PM > To: Sriram Dandapani > Cc: pgsql-admin@postgresql.org > Subject: Re: [ADMIN] slow cursor > > 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 > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > -- 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