Re: Commit every N rows in PL/pgsql

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Commit every N rows in PL/pgsql
Дата
Msg-id AANLkTiligaKIeNWFkhAFGTUNchl-TMV51QnyRJuTjOIE@mail.gmail.com
обсуждение исходный текст
Ответ на Commit every N rows in PL/pgsql  (Len Walter <len.walter@gmail.com>)
Список pgsql-general
Hello

it is useless in PostgreSQL - it isn't important if you commit one or
billion updated rows. PostgreSQL has different implementation of
transactions, so some Oracle's issues are not here.

Regards
Pavel Stehule

2010/5/26 Len Walter <len.walter@gmail.com>:
> Hi,
> I need to populate a new column in a Postgres 8.3 table. The SQL would be
> something like "update t set col_c = col_a + col_b". Unfortunately, this
> table has 110 million rows, so running that query runs out of memory.
> In Oracle, I'd turn auto-commit off and write a pl/sql procedure that keeps
> a counter and commits every 10000 rows (pseudocode):
> define cursor curs as select col_a from t
> while fetch_from_cursor(curs) into a
>      update t set col_c = col_a + col_b where col_a = a
>      i++
>      if i > 10000
>          commit; i=0;
>      end if;
>      commit;
> PL/pgsql doesn't allow that because it doesn't support nested transactions.
> Is there an equivalent Postgres way of doing this?
> cheers,
> Len
> --
> len.walter@gmail.com skype:lenwalter  msn:len.walter@gmail.com
>

В списке pgsql-general по дате отправления:

Предыдущее
От: Jaime Casanova
Дата:
Сообщение: Re: Commit every N rows in PL/pgsql
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: Commit every N rows in PL/pgsql