Skip site navigation (1) Skip section navigation (2)

Re: UPDATE... FROM - will ORDER BY not respected?

From: Adam Rich <adam(dot)r(at)sbcglobal(dot)net>
To: Carlo Stonebanks <stonec(dot)register(at)sympatico(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: UPDATE... FROM - will ORDER BY not respected?
Date: 2009-04-28 20:28:40
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Carlo Stonebanks wrote:
>> I think the ORDER BY is free to update the rows in any order it needs
>> to.  The key is to put the sequence further down.  How about this?
> Adam - thanks. Unless I hear otherwise I will assume that you mean the 
> UPDATE is free to update the rows in any way it wants - irregardless of 
> how whether the data return in the FROM clause is ordered.

Whoops - you're right, that's what I meant.  Even though one of the
tables is sorted, when it joins the two tables, the planner might decide
it's cheaper to update impt_table by iteratively looking up values from
the sorted table that match the (unordered) rows from impt_table, or
by hashing the keys which I think also results in unsorted updates.
You can use "explain" to see the details.


In response to

pgsql-general by date

Next:From: Tom LaneDate: 2009-04-28 21:51:55
Subject: Re: Restore Crashes Postgres
Previous:From: Raymond O'DonnellDate: 2009-04-28 20:19:07
Subject: Re: Welcome to the pgsql-bugs list!

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group