Difference between revisions of "Performance Analysis and Troubleshooting"

From Opentaps Wiki
Jump to navigationJump to search
m (Protected "Performance Analysis and Troubleshooting": Sysop page [edit=sysop:move=sysop])
m (Monitoring Deadlocks in PostgreSQL)
Line 7: Line 7:
  
 
<pre>
 
<pre>
select pg_class.relname, pg_locks.mode, pg_locks.relation, pg_locks.transaction, pg_locks.pid from pg_class, pg_locks where pg_class.relfilenode=pg_locks.relation order by pid
+
select pg_class.relname, pg_locks.mode, pg_locks.relation, pg_locks.transaction, pg_locks.pid
 +
    from pg_class, pg_locks  
 +
    where pg_class.relfilenode=pg_locks.relation  
 +
    order by pid
 
</pre>
 
</pre>
  
 
This will show what kinds of locks are active on what entities.  If there is an exclusive lock on a table followed by a bunch of pids that are waiting for it, then you have a deadlock.
 
This will show what kinds of locks are active on what entities.  If there is an exclusive lock on a table followed by a bunch of pids that are waiting for it, then you have a deadlock.

Revision as of 00:53, 24 January 2008

This is a page to assist with performance analysis and troubleshooting.


Monitoring Deadlocks in PostgreSQL

You can monitor any database locks using the Entity SQL Processor in Webtools -> Entity SQL Processor with the following query,

select pg_class.relname, pg_locks.mode, pg_locks.relation, pg_locks.transaction, pg_locks.pid
    from pg_class, pg_locks 
    where pg_class.relfilenode=pg_locks.relation 
    order by pid

This will show what kinds of locks are active on what entities. If there is an exclusive lock on a table followed by a bunch of pids that are waiting for it, then you have a deadlock.