Thursday, October 6, 2011

Postgresql table locks

Another interesting link regarding postgresql is this one about glancing at active table locks:

http://heatware.net/databases/how-view-see-table-row-locks-postgres/

select t.relname,l.locktype,page,virtualtransaction,pid,mode,granted from pg_locks l, pg_stat_all_tables t where l.relation=t.relid order by relation asc;

http://wiki.postgresql.org/wiki/Lock_Monitoring
Thanks to this I could figure out that there were a bunch of locks on a table one of my etl jobs uses.

Then I realized I needed a refresher for the lock concepts.

http://www.commandprompt.com/ppbook/r27479

I can see now, my job's generating a deadlock, goddamn it!

No comments:

Post a Comment