Skip site navigation (1) Skip section navigation (2)

Re: Table UPDATE is too slow

From: "Steinar H(dot) Gunderson" <sgunderson(at)bigfoot(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Table UPDATE is too slow
Date: 2004-08-31 18:48:45
Message-ID: 20040831184845.GA24976@uio.no (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-performance
On Tue, Aug 31, 2004 at 11:35:38AM -0700, Ron St-Pierre wrote:
> We're doing it in multiple transactions within the function. Could we do 
> something like this?:
> 
> ....
> BEGIN
>  FOR rec IN SELECT field01, field02, ... FROM otherTable LOOP 
>  RETURN NEXT rec;
>  UPDATE dataTable SET field01=rec.field01, field02=rec.field02, 
>  rec.field03=field03, ...
>    WHERE id = rec.id;
> COMMIT;
> ....
> 
> 
> If we can do it this way, are there any other gotcha's we should be 
> aware of?

AFAIK you should be able to do this, yes (although I have no experience with
PL/SQL); I'm not sure how much it buys you, but you might want to test it, at
least.

/* Steinar */
-- 
Homepage: http://www.sesse.net/

In response to

pgsql-performance by date

Next:From: Jean-Max ReymondDate: 2004-08-31 18:59:11
Subject: Optimizing a request
Previous:From: Frank WilesDate: 2004-08-31 18:46:19
Subject: Re: Table UPDATE is too slow

pgsql-general by date

Next:From: Gaetano MendolaDate: 2004-08-31 18:53:04
Subject: Re: Forcing a stored procedure recompile
Previous:From: Vidyasagara GuntakaDate: 2004-08-31 18:48:26
Subject: Not able to build libpq for Windows

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group