pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steinar H. Gunderson <sgunderson@bigfoot.com>
To: pgsql-performance@postgresql.org
Subject: Re: Table UPDATE is too slow
Date: Tue, 31 Aug 2004 20:48:45 +0200
Message-ID: <20040831184845.GA24976@uio.no> (raw)
In-Reply-To: <4134C4FA.20404@syscor.com>
References: <4134BF36.3000504@syscor.com>
	<20040831181815.GB24253@uio.no>
	<4134C4FA.20404@syscor.com>

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/



view thread (16+ messages)  latest in thread

Message-ID: <20040831184845.GA24976@uio.no>
Permalink:  ../20040831184845.GA24976@uio.no/
Also on:    postgresql.org/message-id/20040831184845.GA24976@uio.no

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: sgunderson@bigfoot.com
  Subject: Re: Table UPDATE is too slow
  In-Reply-To: <20040831184845.GA24976@uio.no>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox