Re: how to release a transaction lock on a table?

From: Christopher Browne <cbbrowne(at)acm(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: how to release a transaction lock on a table?
Date: 2005-02-05 15:03:28
Message-ID: m3wttnjbgf.fsf@knuth.knuth.cbbrowne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martha Stewart called it a Good Thing when schen(at)graciousstyle(dot)com (Si Chen) wrote:
> Hello everyone. I am trying to do an ALTER TABLE, but it hangs
> indefinitely. I think the table is locked from a transaction, and in
> pg_locks I found:
> relation 75907
> database 74861
> pid 29604
> mode AccessExclusiveLock
> granted f
>
> Is there a way to release this lock? Or does the database need to
> re-started?

Note that it says "granted f".

The lock has only been requested; it hasn't been granted.

Some other transaction is holding onto the table and preventing that
lock from being acquired.

You might indeed want to rummage around and see what other locks there
are on the table, and perhaps interrupt the other processing.

This sort of maintenance may require locking out "application users"
so that you can get all of the locks you need to upgrade the
application.

It oughtn't be necessary to shut down the DB, though.
--
select 'cbbrowne' || '@' || 'gmail.com';
http://www3.sympatico.ca/cbbrowne/nonrdbms.html
"I've seen estimates that 10% of all IDs in the US are phony. At least
one-fourth of the president's own family has been known to use phony
IDs." -- Bruce Schneier CRYPTO-GRAM, December 15, 2001

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2005-02-05 15:45:26 Re: pgpool 2.5b2 released
Previous Message Christopher Browne 2005-02-05 15:00:18 Re: is this index bloat?