Re: Postgres and multiple updates in one statement - Mailing list pgsql-general

From Tom Lane
Subject Re: Postgres and multiple updates in one statement
Date
Msg-id 11479.1248709813@sss.pgh.pa.us
Whole thread Raw
In response to Re: Postgres and multiple updates in one statement  (Scott Marlowe <scott.marlowe@gmail.com>)
Responses Re: Postgres and multiple updates in one statement
List pgsql-general
Scott Marlowe <scott.marlowe@gmail.com> writes:
> On Mon, Jul 27, 2009 at 8:48 AM, Jamie
> Lawrence-Jenner<jamie.jenner@autovhc.co.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

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Postgres and multiple updates in one statement
Next
From: Keaton Adams
Date:
Subject: Running vacuumdb -a taking too long