Received: from mail.euroweb.hu (mail.euroweb.hu [193.226.220.4]) by hub.org (8.8.8/8.7.5) with ESMTP id EAA22564 for ; Thu, 11 Jun 1998 04:36:29 -0400 (EDT) Received: (from hu252pr@localhost) by mail.euroweb.hu (8.8.5/8.8.5) id KAA11225 for pgsql-sql@postgresql.org; Thu, 11 Jun 1998 10:36:25 +0200 (MET DST) Received: from wagnerur (lendvary-g.prolan.hu [193.91.83.34]) by aix.prolan.hu (AIX4.2/UCB 8.7/8.7) with SMTP id KAA16358 for ; Thu, 11 Jun 1998 10:13:37 +0200 (DFT) Sender: gyurika@aix.prolan.hu Message-ID: <357F925F.6299EB1C@prolan.hu> Date: Thu, 11 Jun 1998 10:16:31 +0200 From: Lendvary Gyorgy X-Mailer: Mozilla 3.01Gold (X11; I; Linux 2.0.30 i586) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: update by one transaction Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, I have tried to write my problem, but I think nobody couldn,t understand it (because of my bad English, I think). I have a table for instance boci (row_number int, col2 float, col3 float). The boci table has about 10000 rows. I want to update col3 column of the table in every row with different values. Desired values are in an array has 10000 elements. I want to be the value of the col3 column in the first row equal to the first element of the array and so on. I've done it with a 'for' cycle, but it is very slow. I want to do theese updates with one transaction. Here is a little piece of my program: 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, "COMMIT"); This program is very, very slow. Is there any way making this program much faster (for instance with CURSOR or 'block write' or something else)? Please write me a little program that describes your ideas! Thanks for your help in advance!