Re: Table UPDATE is too slow - Mailing list pgsql-performance

From Steinar H. Gunderson
Subject Re: Table UPDATE is too slow
Date
Msg-id 20040831184845.GA24976@uio.no
Whole thread Raw
In response to Re: Table UPDATE is too slow  (Ron St-Pierre <rstpierre@syscor.com>)
List pgsql-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/

pgsql-performance by date:

Previous
From: Frank Wiles
Date:
Subject: Re: Table UPDATE is too slow
Next
From: Jean-Max Reymond
Date:
Subject: Optimizing a request