Re: [SQL] update by one transaction

From: dave madden <dhm(at)paradigm(dot)webvision(dot)com>
To: gyurika(at)prolan(dot)hu
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] update by one transaction
Date: 1998-06-11 17:06:19
Message-ID: 199806111706.KAA18099@paradigm.webvision.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

=>From: Lendvary Gyorgy <gyurika(at)prolan(dot)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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message M Simms 1998-06-11 17:46:05 sequence problems
Previous Message Byron Nikolaidis 1998-06-11 15:53:07 Re: [INTERFACES] Re: M$-Access'97 and TIMESTAMPs