Re: Postgres and multiple updates in one statement

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: Jamie Lawrence-Jenner <jamie(dot)jenner(at)autovhc(dot)co(dot)uk>, nha <lyondif02(at)free(dot)fr>, PgSQL-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres and multiple updates in one statement
Date: 2009-07-27 15:50:13
Message-ID: 11479.1248709813@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> writes:
> On Mon, Jul 27, 2009 at 8:48 AM, Jamie
> Lawrence-Jenner<jamie(dot)jenner(at)autovhc(dot)co(dot)uk> wrote:
>> Our update statements are as follows
>>
>> Update table set col1=x,col2=y where pkid=1;
>> Update table set col1=x,col2=y where pkid=2;
>> Update table set col1=x,col2=y where pkid=3;
>>
>> Very simple and straight forward. Sometimes there could be as many as 50
>> update statements to process.

> Might as well fire them each as separate statements inside one
> transaction, since pkid is unique and non-repeated in the updates.

If they're all exactly the same pattern like that, it might be worth the
trouble to set up a prepared statement.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2009-07-27 15:52:28 Re: Calculating the difference between timetz values
Previous Message Keaton Adams 2009-07-27 15:43:03 Running vacuumdb -a taking too long