patternsqlMinor
Postgresql 9 table lock resolution
Viewed 0 times
postgresqlresolutiontablelock
Problem
I have an
From my limited understanding I think it's a table level lock that isn't releasing. The table
If it helps the statement is one that's been created by the Django ORM (South in particular).
Thanks.
ALTER TABLE statement that according to pg_stat is "waiting", and I'm wondering if there is an easy fix to allow the statement to execute? From my limited understanding I think it's a table level lock that isn't releasing. The table
pg_locks shows a single AccessExclusiveLock that has its granted column set to f. Running ps aux | grep postgres confirms that there is a postgres ALTER TABLE waiting. If it helps the statement is one that's been created by the Django ORM (South in particular).
Thanks.
Solution
There is most probably another transaction open that did a select on that table.
Look for sessions that are " in transaction".
Make sure they end their transaction (so that the sessions shows "" or if you cannot do that, kill them with
Look for sessions that are " in transaction".
Make sure they end their transaction (so that the sessions shows "" or if you cannot do that, kill them with
pg_terminate_backend()Context
StackExchange Database Administrators Q#14040, answer score: 3
Revisions (0)
No revisions yet.