Re: Clearing locks - Mailing list pgsql-admin

From Alvaro Herrera
Subject Re: Clearing locks
Date
Msg-id 1275939916-sup-6638@alvh.no-ip.org
Whole thread Raw
In response to Clearing locks  (Matthew Excell <mexcell@ucentive.net>)
Responses Re: Clearing locks
List pgsql-admin
Excerpts from Matthew Excell's message of lun jun 07 15:33:27 -0400 2010:
> I'm on PostgreSQL 8.3.11 on Debian.
>
> I have a small piece of DDL (alter table title drop column is_target) that
> hangs "waiting" forever. (I've waited hours - it still shows as waiting in
> pg_top.)  I have restarted the database - even tried it in single-user mode
> - but it still waits.
>
> When I execute a query to get lock info:
>
> select
> pg_class.relname,pg_locks.locktype,mode,virtualtransaction,database,relation,granted
> from pg_class,pg_locks where pg_class.relfilenode=pg_locks.relation;
>
> (These are all the columns in pg_locks with anything but null in them.)
>
>                relname                | locktype |      mode       |
> virtualtransaction | database | relation | granted
>
--------------------------------------+----------+-----------------+--------------------+----------+----------+---------
>  property_key_name_index              | relation | AccessShareLock |
> -1/22805859        |    64197 |   361377 | t

uh.  Check pg_prepared_transactions (or was it pg_prepared_xacts?) and
do a ROLLBACK PREPARED (or COMMIT PREPARED) if there's anything that
shouldn't be there.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-admin by date:

Previous
From: Matthew Excell
Date:
Subject: Clearing locks
Next
From: Matthew Excell
Date:
Subject: Re: Clearing locks