Search Postgresql Archives

Re: Strange behavior: row won't delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Phoenix Kiula <phoenix.kiula@xxxxxxxxx> writes:

> I guess my question is, how should I remove all pending locks on a
> table so that I can get on with the rest of the stuff?
>
> I mean, even if I can now find an offending RULE on the table, I
> cannot replace or remove it. '

You're off on the wrong track. Locks are held by transactions until the
transaction commits. You need to find the transactions which are holding these
locks and either commit or roll them back.

You look in pg_locks to see what locks transactions are holding. In particular
look for rows with "granted" set to "t", especially locks on relations and
especially ExclusiveLocks.

Then you take the pid of those transactions and look in pg_stat_activity to
see what they're up to. If they say "<idle in transaction>" then they're
waiting for the client to do something. If they stay that way for any length
of time while holding locks which block other transactions that's bad.

Alternately if you see a query in pg_stat_transaction which is taking a long
time to run you might check whether you have a bad plan or a bad query running
while holding locks effectively doing the same thing.

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's RemoteDBA services!

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux