From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Clarence Gardner <clarence(at)silcom(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: deadlock avoidance |
Date: | 2006-09-26 01:47:02 |
Message-ID: | 17858.1159235222@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Clarence Gardner <clarence(at)silcom(dot)com> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2006-09-26 02:09:24 | Re: Restart after poweroutage |
Previous Message | Clarence Gardner | 2006-09-25 23:58:37 | deadlock avoidance |