Fixing stale locks

From: "Chris Waters" <chris(dot)waters(at)networkchemistry(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Fixing stale locks
Date: 2002-12-14 18:44:04
Message-ID: atfu21$2qhv$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

I am a new postresql user, but have done a lock of work with Oracle. I am
having a familiar problem with stale locks. I try to drop a table in psql
but the transaction hangs. I can abort the transaction with Ctl-C, but it
will never succeed.

My first instinct was a stale lock so I look in pg_locks and sure enough a
lock exists. Now the question is, how do I free this lock? This is just a
single machine installation and there are no processes running that could
hold the lock. I suspect it is from a process that crashed. Under Oracle we
used to just kill the pid that held the lock and the DB cleaned everything
up. When I tried that under postgresql my database crashed. Obviously the
PID column in the pg_locks table is for the server process, not the client
process :-(.

How do people normally deal with this type of problem?

Thanks,

Chris.

--
chris(dot)waters(at)networkchemistry(dot)com
www.networkchemistry.com

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Jesus Sandoval 2002-12-15 01:14:39 Re: Database maintenance help
Previous Message David F. Skoll 2002-12-14 13:56:48 Re: Database maintenance help