Re: Deadlock on the same object?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Deadlock on the same object?
Date: 2009-11-11 15:05:58
Message-ID: 6027.1257951958@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> writes:
> I encountered the following log in 8.4.1 and HEAD. The deadlock occured
> on the same object (relation 17498 of database 17497). Is it reasonable?

I think this is an artifact of the fact that SQL functions parse the
whole querystring before executing any of it. Parsing of "DELETE FROM
a" will result in acquiring ROW EXCLUSIVE lock on a, and then when the
LOCK commands are executed, you have a lock-upgrade scenario and the
deadlock is unsurprising.

There was some discussion of changing that awhile ago, but I forget
what the conclusion was. In any case nothing's been done about it.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2009-11-11 15:07:53 Re: Hot standby, freezing
Previous Message Tom Lane 2009-11-11 14:47:30 Re: total execution time as reported by auto_explain