• Data Warehouse Service

dws
  1. Help Center
  2. Data Warehouse Service
  3. Developer Guide
  4. Systems Tables and Views
  5. PG_LOCKS

PG_LOCKS

PG_LOCKS stores information about the locks held by open transactions.

Table 1 PG_LOCKS columns

Name

Type

Reference

Description

locktype

text

-

Type of the locked object: relation, extend, page, tuple, transactionid, virtualxid, object, userlock, and advisory

database

oid

PG_DATABASE.oid

OID of the database in which the locked target exists

  • The OID is zero if the target is a shared object.
  • The value is NULL if the OID is a transaction ID.

relation

oid

PG_CLASS.oid

OID of the relationship targeted by the lock. The value is null if the object is not a relation or part of a relation.

page

integer

-

Page number targeted by the lock within the relationship. If the object is not a relation page or row page, the value is null.

tuple

smallint

-

Row number targeted by the lock within the page. If the object is not a row, the value is null.

virtualxid

text

-

Virtual ID of the transaction targeted by the lock. If the object is not a virtual transaction ID, the value is null.

transactionid

xid

-

ID of the transaction targeted by the lock. If the object is not a transaction ID, the value is null.

classid

oid

PG_CLASS.oid

OID of the system table that contains the object. If the object is not a general database object, the value is null.

objid

oid

-

OID of the lock target within its system table. If the target is not a general database object, the value is null.

objsubid

smallint

-

Column number for a column in the table. The value is zero if the target is some other object type. If the object is not a general database object, the value is null.

virtualtransaction

text

-

Virtual ID of the transaction holding or awaiting this lock.

pid

bigint

-

Logical ID of the server thread holding or awaiting this lock. This is null if the lock is held by a prepared transaction.

mode

text

-

Lock mode held or desired by this thread

granted

Boolean

-

Whether the lock is a held lock

  • The value is true if the lock is a held lock.
  • The value is false if the lock is an awaited lock.

fastpath

Boolean

-

Whether the lock is obtained through fast-path (true) or main lock table (false)