Re: AccessExclusiveLock on tuple?

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Christophe Pettus <xof(at)thebuild(dot)com>
Cc: pgsql-general list <pgsql-general(at)postgresql(dot)org>
Subject: Re: AccessExclusiveLock on tuple?
Date: 2015-12-02 17:25:03
Message-ID: 20151202122503.4a0b3f401d5d3d2178cb258a@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2 Dec 2015 09:01:37 -0800
Christophe Pettus <xof(at)thebuild(dot)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.045 ms
>
> What conditions produce an "AccessExclusiveLock on tuple"? Attempting to lock a tuple when another process has done an explicit 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2015-12-02 17:31:44 Re: AccessExclusiveLock on tuple?
Previous Message Jeff Janes 2015-12-02 17:18:37 Re: XID wraparound with huge pg_largeobject