Re: making multiple updates use indexes: howto? - Mailing list pgsql-general

From Jim C. Nasby
Subject Re: making multiple updates use indexes: howto?
Date
Msg-id 20030709143258.GJ69704@nasby.net
Whole thread Raw
In response to Re: making multiple updates use indexes: howto?  (Mike Mascari <mascarm@mascari.com>)
List pgsql-general
On Mon, Jul 07, 2003 at 05:58:00PM -0400, Mike Mascari wrote:
> 2. I've found the following syntax to perform better, although I'm not
> sure of its portability:
>
> UPDATE stockline SET status = 3
> WHERE stockline.id = lap_mpdetail_view.id AND
> lap_mpdetail_view.lap = 3976;

Very un-portable. PGSQL is the only database I know of that will
construct a FROM clause for you on it's own. You should at least add

FROM lap_mpdetail_view

to the update. Even that isn't highly portable, though at least some
databases support that syntax. (Sybase and MS SQL come to mind).

--
Jim C. Nasby, Database Consultant                  jim@nasby.net
Member: Triangle Fraternity, Sports Car Club of America
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

pgsql-general by date:

Previous
From: Bjørn T Johansen
Date:
Subject: Re: Sorting on fieldtype Time?
Next
From: Michal Zaborowski
Date:
Subject: Re: Native dataprovider on Windows