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

From Joshua Tolley
Subject Re: Postgres and multiple updates in one statement
Date
Msg-id 20090727133755.GI10077@eddie
Whole thread Raw
In response to Re: Postgres and multiple updates in one statement  (Scott Marlowe <scott.marlowe@gmail.com>)
List 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.jenner@autovhc.co.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

Attachment

pgsql-general by date:

Previous
From: nha
Date:
Subject: Re: Postgres and multiple updates in one statement
Next
From: "Jamie Lawrence-Jenner"
Date:
Subject: Postgres and multiple updates in one statement