Locks (blocked) v1

Description

The page provides information about all transactions which are blocking other transactions.

In particular, we see the locks held by the blocking transaction, the locks requested by the blocked transaction, the queries in each transaction, and the initial text of each query, so it’s hopefully easy to figured out which queries are involved.

The query which generates this page will itself issue a number of locks, which will also be present in the output.

Columns

Name Type
schema_id int8
schema varchar
object:type varchar
object:id int8
object:name varchar
blocking:user_id int4
blocking:user varchar
blocking:pid int4
blocking:xid int8
blocking:lock type varchar
blocking:start timestamp
blocking:duration interval
blocking:texts varchar
blocked:user_id int4
blocked:user varchar
blocked:pid int4
blocked:xid int8
blocked:lock type varchar
blocked:start timestamp
blocked:duration interval
blocked:texts varchar

Column Descriptions

schema_id

The schema ID. This column is emitted in CSV exports only.

schema

The schema name.

object:type

Set to table or view.

object:id

The ID of the contended object. This is column emitted in CSV exports only.

object:name

The name of the contended object.

blocking:user_id

The user ID of the owner of the blocking transaction. This is column emitted in CSV exports only.

blocking:user

The user name of the owner of the blocking transaction.

blocking:pid

Blocking process process ID.

blocking:xid

Blocking transaction ID.

blocking:lock type

Lock Type Description
AccessExclusiveLock Blocks AccessShareLock and ShareRowExclusiveLock locks
AccessShareLock Blocks AccessExclusiveLock locks
ShareRowExclusiveLock Blocks other ShareRowExclusiveLock locks

blocking:start

Blocking transaction start timestamp.

blocking:duration

Blocking transaction duration, in microseconds.

blocking:texts

This field consists of the first 48 character of every query in the blocking transaction, separated by newlines, ordered from most recent to oldest.

Transactions hold and always hold all locks granted to them, and it is not possible to know from the system tables which queries caused which locks to be granted, so it is not possible to indicate which particular query took the lock which is blocking the blocked queries.

blocked:user_id

The user ID of the owner of the blocked transaction. This is column emitted in CSV exports only.

blocked:user

The user name of the owner of the blocked transaction.

blocked:pid

Blocked process process ID.

blocked:xid

Blocked transaction ID.

blocked:lock type

Lock Type Description
AccessExclusiveLock Blocks AccessShareLock and ShareRowExclusiveLock locks
AccessShareLock Blocks AccessExclusiveLock locks
ShareRowExclusiveLock Blocks other ShareRowExclusiveLock locks

blocked:start

Blocked transition start timestamp.

blocked:duration

Blocked transaction duration, in microseconds.

blocked:texts

This field consists of the first 48 character of every query in the blocked transaction, separated by newlines, ordered from most recent to oldest.

The most recent query will be the particular query which has become blocked.