Re: Postgres and multiple updates in one statement

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

On Mon, Jul 27, 2009 at 07:31:37AM -0600, Scott Marlowe wrote:
> On Mon, Jul 27, 2009 at 2:10 AM, Jamie
> Lawrence-Jenner<jamie(dot)jenner(at)autovhc(dot)co(dot)uk> wrote:
> > 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.

You could possibly use UNION or UNION ALL to consolidate your 5 passes into
one pass. You could also possibly use UPDATE FROM to avoid having to return
the primary keys at all, and get the whole thing done in one query.

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jamie Lawrence-Jenner 2009-07-27 14:48:53 Re: Postgres and multiple updates in one statement
Previous Message nha 2009-07-27 13:34:54 Re: Postgres and multiple updates in one statement