Re: Table UPDATE is too slow

Поиск
Список
Период
Сортировка
От Steinar H. Gunderson
Тема Re: Table UPDATE is too slow
Дата
Msg-id 20040831184845.GA24976@uio.no
обсуждение исходный текст
Ответ на Re: Table UPDATE is too slow  (Ron St-Pierre <rstpierre@syscor.com>)
Список 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 по дате отправления:

Предыдущее
От: Frank Wiles
Дата:
Сообщение: Re: Table UPDATE is too slow
Следующее
От: Jean-Max Reymond
Дата:
Сообщение: Optimizing a request