Search Postgresql Archives

Re: deadlock avoidance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Clarence Gardner <clarence@xxxxxxxxxx> writes:
> I noticed the following in some of our code today:
>     select ... <join list> ... for update of a, b;

> Inasmuch as the cardinal rule for avoiding deadlocks is to acquire
> locks in a consistent order, should such a construction be avoided
> in favor of two separate "select ... for update" statements so that
> the order of acquisition of a and b is known?

If you're worried about deadlock, what you should be worrying about is
the order in which the individual rows are visited --- and splitting
this into two SQL commands doesn't in itself guarantee more about that
than the command as given.

			regards, tom lane


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux