Solved

how to get the deadlock graph in postgres

Posted on 2011-03-14
4
1,019 Views
Last Modified: 2012-08-14
HI
I would like to know how to get the deadlock graph in postgres when a deadlock occurs.

Thanks
0
Comment
Question by:elimesika
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 22

Expert Comment

by:earth man2
ID: 35152818
select * from pg_locks;
0
 
LVL 19

Assisted Solution

by:elimesika
elimesika earned 0 total points
ID: 35181437
Thanks :earthman2

That is obvious, but what am I looking for is :
1) The list of nodes involved in the  deadlock.
2) The SQL statement each node was trying to process when the deadlock occurred.
3) The process that was chosen by the DB as a victim.

How can I get that information ?

Thanks
0
 
LVL 19

Accepted Solution

by:
elimesika earned 0 total points
ID: 35187958
Well ,just to share the solution:

Postgres 8.4 added deadlock graph info to the server log
see
"When reporting a deadlock, report the text of all queries involved in the deadlock to the server log (Itagaki Takahiro) "
in
http://www.postgresql.org/docs/8.4/static/release-8-4.html#RELEASE-8-4-PG-HBA-CONF
The reason that I didn'r got that in my log was that I was using an EXCEPTION block on OTHERS.
That includes of course the DEADLOCK_DETECTED SQLSTATE value and masked the default behaviour.
so, to get the info, let postgres trap the deadlock and handle it.

such simple ....


0
 
LVL 19

Author Closing Comment

by:elimesika
ID: 35225135
I have found the solution by myself.
0

Featured Post

Myth Busting: MongoDB Scalability (it scales!)

I was talking with one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. He mentioned to me that several customers have been telling him that “MongoDB doesn’t scale!” MongoDB’s scalability was in question?

My response was, “Is that a joke?"

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question