From: | Matt Mello <alien(at)spaceship(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: "deadlock detected" documentation |
Date: | 2003-05-15 19:06:36 |
Message-ID: | 3EC3E53C.9070800@spaceship.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Okay, so one last question on this...
If I do the following, assuming I haven't applied the patch, will it
still result in a deadlock (in other words, does this only happen with
multi-record updates, or can it happen with independent single-record
updates inside transactions)?
THREAD1: THREAD2:
BEGIN;
update txn set ... where txn.terminalid = 1;
BEGIN;
update txn set ... where txn.terminalid = 2;
(I anticipate the next statement will give me a deadlock.)
update txn set ... where txn.terminalid = 2;
update txn set ... where txn.terminalid = 1;
COMMIT;
COMMIT;
Thanks, again!
Tom Lane wrote:
> Matt Mello <alien(at)spaceship(dot)com> writes:
>
>>I see. One item I forgot to mention ... Both update statements have a
>>where clause containing txn.terminalid=38. Txn.terminalid is a foreign
>>key column in that table (txn.terminalid->terminal.terminalid). Could
>>this be the source of the trouble?
>
>
> Not per se. The problem depends on which rows get updated and in what
> sequence --- the contents of the WHERE clause aren't the issue, except
> insofar as they determine the set of rows to be updated.
>
> regards, tom lane
>
>
--
Matt Mello
512-350-6900
From | Date | Subject | |
---|---|---|---|
Next Message | Cyber Join | 2003-05-15 20:05:26 | select 3 characters |
Previous Message | Alvar Freude | 2003-05-15 18:10:03 | Re: SQL Parser |