Re: [SQL] update by one transaction

Поиск
Список
Период
Сортировка
От dave madden
Тема Re: [SQL] update by one transaction
Дата
Msg-id 199806111706.KAA18099@paradigm.webvision.com
обсуждение исходный текст
Ответ на update by one transaction  (Lendvary Gyorgy <gyurika@prolan.hu>)
Список pgsql-sql
 =>From: Lendvary Gyorgy <gyurika@prolan.hu>
 =>...
 =>PQexec(conn, "BEGIN");
 =>for (i=0; i<10000; i++)
 =>{
 =>    sprintf(buff, "UPDATE boci SET col3 = %f WHERE row_number=%d",
 =>array[i], i);
 =>    PQexec(conn, buff);
 =>}
 =>PQexec(conn, "END");
 =>
 =>This program is very, very slow.

The first thing I'd check is that you have an index on
boci(row_number).  If you do, or if adding one doesn't help, then
perhaps you could split boci into two tables:

        boci1( row_number int, col2 float )
        boci2( row_number int, col3 float )

Then you could use the COPY command to load data from your array.  To
select things, just join boci1 and boci2 on row_number (or create a
view, if PostgreSQL supports 'em).

d.

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

Предыдущее
От: Lendvary Gyorgy
Дата:
Сообщение: update by one transaction
Следующее
От: M Simms
Дата:
Сообщение: sequence problems