From: Peter Eisentraut <peter_e@gmx.net>
To: andre <andre@google.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: [GENERAL] How to detect Postgres deadlocks?
Date: Wed, 23 Aug 2006 22:39:22 +0200
Message-ID: <200608232239.22827.peter_e@gmx.net> (raw)
In-Reply-To: <6c3954020608231245l3035ffbby41cfdbfac2d37326@mail.google.com>
References: <6c3954020608231245l3035ffbby41cfdbfac2d37326@mail.google.com>
andre wrote:
> 1) Which sql queries should I use to detect deadlocks while they are
> happening? I see the deadlock info on the log file, but I'd like to
> query the database to see them as they happen...
Since deadlocks are broken up within one second, it will be hard to
actually see them. You could crank up the deadlock timeout and then
query pg_locks and infer cycles from there. From there you can also
move over to the statistics tables to see what the processes are
currently doing. But the system won't actually tell you that there is
a deadlock until the timeout is over. If you have special requirements
like that, you need to patch the source.
The other option is to decorate your server log lines with pids and such
that you can link from the deadlock error message to the logged
statements.
--
Peter Eisentraut
http://developer.postgresql.org/~petere/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: peter_e@gmx.net, andre@google.com
Subject: Re: [GENERAL] How to detect Postgres deadlocks?
In-Reply-To: <200608232239.22827.peter_e@gmx.net>
References: <6c3954020608231245l3035ffbby41cfdbfac2d37326@mail.google.com> <200608232239.22827.peter_e@gmx.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox