Unix Technical Forum

Deadlock

This is a discussion on Deadlock within the Pgsql General forums, part of the PostgreSQL category; --> Is there some kind of log, table or something that I could get more information about a deadlock situation ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 05:58 AM
Bart McFarling
 
Posts: n/a
Default Deadlock

Is there some kind of log, table or something that I could get more
information about a deadlock situation that is occurring in my database? I
just get a transaction number and a process id, which is useless to me
because my application terminates on any errors from the database? It occurs
infrequently (about once a day) and I have no idea how to track it down.
Also sometimes the database just freezes (RedHat EL 3.0 Postgresql 8.0.1)
could this be a deadlock situation? There is nothing in the log about
deadlock or anything else when it freezes (this happens about once every
month or so)

Thanks,
Bart


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 05:58 AM
Michael Fuhr
 
Posts: n/a
Default Re: Deadlock

On Thu, Sep 15, 2005 at 12:32:05PM -0500, Bart McFarling wrote:
> Is there some kind of log, table or something that I could get more
> information about a deadlock situation that is occurring in my database? I
> just get a transaction number and a process id, which is useless to me
> because my application terminates on any errors from the database?


See "Error Reporting and Logging" in the "Server Run-time Environment"
chapter of the documentation:

http://www.postgresql.org/docs/8.0/i...CONFIG-LOGGING

> It occurs infrequently (about once a day) and I have no idea how to
> track it down.


You could log all queries or use log_min_error_statement to log
only queries that result in an error. Typical causes of deadlock
are multiple transactions updating the same records in different
orders, and doing inserts/updates that reference the same foreign
keys in different orders (in released versions of PostgreSQL,
referential integrity checks do a SELECT FOR UPDATE on the referenced
key to ensure that it doesn't change while the transaction is still
active; in 8.1 such locks will be acquired with SELECT FOR SHARE,
which should reduce the incidence of deadlock).

> Also sometimes the database just freezes (RedHat EL 3.0 Postgresql 8.0.1)
> could this be a deadlock situation? There is nothing in the log about
> deadlock or anything else when it freezes (this happens about once every
> month or so)


What are the symptoms of this "freeze"? Do only some queries block?
Do all queries block, even queries such as "SELECT now()"? Are you
able to connect to the database at all? If you can connect, have
you examined pg_locks? If you can't connect, have you done a process
trace or used a debugger to see what the database is doing?

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:24 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com