pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
AccessExclusiveLock with pg_locks.locktype of tuple
2+ messages / 2 participants
[nested] [flat]

* AccessExclusiveLock with pg_locks.locktype of tuple
@ 2019-12-18 23:01  Erik Jones <mage2k@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Erik Jones @ 2019-12-18 23:01 UTC (permalink / raw)
  To: pgsql-general

Greetings,

I've seen locks with mode of AccessExclusiveLock and locktype of tuple a
few times now but have never been able to reproduce one nor had a chance to
dig into them and now have a couple questions on them:

* When is this kind of heavy lock on a row/tuple taken out?  I've done some
code spelunking but have yet to find anything.
* An AccessExcluciveLock on a tuple should only block all other access to
the given tuple, yes?  It won't block access at the table level?  I ask
since the manual only discusses AccessExclusiveLocks in the context of
table level locking.

The only thing I've found so far on them is this old pgsql-general thread
wherein Tom Lane essentially just says, "Yeah, it can happen and is an
implementation detail that can change from version to version."  That was
on 9.4.x and the my most recent confirmed sighting was on a server running
11.3.

-- 
Erik Jones
mage2k@gmail.com

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: AccessExclusiveLock with pg_locks.locktype of tuple
@ 2019-12-19 00:06  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Erik Jones <mage2k@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2019-12-19 00:06 UTC (permalink / raw)
  To: Erik Jones <mage2k@gmail.com>; +Cc: pgsql-general

Erik Jones <mage2k@gmail.com> writes:
> I've seen locks with mode of AccessExclusiveLock and locktype of tuple a
> few times now but have never been able to reproduce one nor had a chance to
> dig into them and now have a couple questions on them:
> * When is this kind of heavy lock on a row/tuple taken out?  I've done some
> code spelunking but have yet to find anything.

It's a transient state while waiting to acquire a "normal" tuple lock,
that is one recorded in the tuple header.  The explanation can be found
in src/backend/access/heap/README.tuplock, and the relevant code is
mostly in heap_lock_tuple().

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-12-19 00:06 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 23:01 AccessExclusiveLock with pg_locks.locktype of tuple Erik Jones <mage2k@gmail.com>
2019-12-19 00:06 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox