Re: Postgres and multiple updates in one statement

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Jamie Lawrence-Jenner <jamie(dot)jenner(at)autovhc(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres and multiple updates in one statement
Date: 2009-07-27 13:31:37
Message-ID: dcc563d10907270631t72919b01xdc78bf51c66f1555@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jul 27, 2009 at 2:10 AM, Jamie
Lawrence-Jenner<jamie(dot)jenner(at)autovhc(dot)co(dot)uk> wrote:
> Hi there
>
> We have a function which runs a set of update clauses and we are considering
> putting all the update clauses into one statement.
>
> I would like to understand how postgres handles multiple updates. If we were
> to send 5 update statements in one sql statement to the db would it:
>
> Do 5 passes on the table, on each pass, retrieve the id then update the row
>
> Do 1 pass to retrieve the 5 primary keys, then update all rows in parallel

I would do 5 passes. Better to have one update statement to reduce bloat.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message nha 2009-07-27 13:34:54 Re: Postgres and multiple updates in one statement
Previous Message Raymond O'Donnell 2009-07-27 13:07:46 Re: Postgres and multiple updates in one statement