Re: Avoiding a deadlock

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Paul Jungwirth *EXTERN*" <pj(at)illuminatedcomputing(dot)com>, pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Avoiding a deadlock
Date: 2013-03-12 08:14:08
Message-ID: A737B7A37273E048B164557ADEF4A58B057BDA0A@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Paul Jungwirth wrote:
>> Out of curiosity: any reason the ORDER BY should be in the subquery? It seems like it ought to be in
> the UPDATE (if that's allowed).
>
> Hmm, it's not allowed. :-) It's still surprising that you can guarantee the order of a multi-row
> UPDATE by ordering a subquery.

To be honest, I don't think that there is any guarantee for this
to work reliably in all comparable cases, as PostgreSQL does
not guarantee in which order it performs the UPDATEs.

It just happens to work with certain plans (use EXPLAIN
to see wat will happen).

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message JotaComm 2013-03-12 13:21:07 Problems with PostgreSQL Replication (Log Shipping)
Previous Message Paul Jungwirth 2013-03-12 00:40:57 Re: Splitting Postgres into Separate Clusters?