Re: [GENERAL] How to detect Postgres deadlocks?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux