Re: AccessExclusiveLock on tuple? - Mailing list pgsql-general

From Bill Moran
Subject Re: AccessExclusiveLock on tuple?
Date
Msg-id 20151202122503.4a0b3f401d5d3d2178cb258a@potentialtech.com
Whole thread Raw
In response to AccessExclusiveLock on tuple?  (Christophe Pettus <xof@thebuild.com>)
Responses Re: AccessExclusiveLock on tuple?  (Christophe Pettus <xof@thebuild.com>)
List pgsql-general
On Wed, 2 Dec 2015 09:01:37 -0800
Christophe Pettus <xof@thebuild.com> wrote:

> On 9.4, I've encountered a locking message I've not seen before:
>
>     process 5293 still waiting for AccessExclusiveLock on tuple (88636,15) of relation 18238 of database 16415 after
5000.045ms 
>
> What conditions produce an "AccessExclusiveLock on tuple"?  Attempting to lock a tuple when another process has done
anexplicit LOCK ACCESS EXCLUSIVE? 

No. See the section on row level locks here:
http://www.postgresql.org/docs/9.4/static/explicit-locking.html

Essentially, any data modification could take an exclusive lock on the row(s)
that it's going to modify. Generally, this will be an UPDATE statement,
although the same thing happens when you do SELECT ... FOR UPDATE.

The message you're seeing simply means that one process has been waiting for
a long time for the lock to release (5 seconds in this case). Deadlocks are
automatically handled, so this is not a deadlock. Although if the process
holding the lock does not commit the transaction, the waiting process will
wait indefinitely.

If this is happening infrequently, it's probably of no concern. If it's
happening frequently, you'll want to investigate what process is holding
the locks for so long and see what can be done about it.

--
Bill Moran


pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: XID wraparound with huge pg_largeobject
Next
From: Christophe Pettus
Date:
Subject: Re: AccessExclusiveLock on tuple?