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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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/

In response to

Browse pgsql-general by date

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

Browse pgsql-performance by date

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