investigating deadlocks

From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: investigating deadlocks
Date: 2004-07-06 15:38:03
Message-ID: 200407061138.03884.xzilla@users.sourceforge.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Is there some way to determine the specific relation involved when a deadlock
occurs? For example in the following error message (with log level set to
verbose):
2004-07-03 20:30:44 [21347] ERROR: 40P01: deadlock detected
DETAIL: Process 21347 waits for ShareLock on transaction 104411804; blocked
by process 21315. Process 21315 waits for ShareLock on transaction 104411808;
blocked by process 21347.
LOCATION: DeadLockReport, deadlock.c:888
STATEMENT: INSERT INTO <snip>

It tells me the transaction id's and process id's involved, but I see no way
to determine which specific relations were involved (the table being inserted
into has several different rules/triggers that touch other tables) Since
the error happens infrequently and randomly, the above information is
outdated by the time I can investigate. I am also skeptical about the message
that it was trying to get ShareLock since afaik share lock level is only used
when creating indexes. I have thought about turning on some of the GUC's
like trace_locks or debug_deadlocks, but the docs are very ambiguous as to
what these items do specifically . Is there some other option I have missed
out on?

Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-07-06 15:38:04 Re: A wanna be
Previous Message Bruce Momjian 2004-07-06 15:37:18 Re: Nested Transactions, Abort All