SYSTEM CATALOGS / SYSTEM VIEWS
pg_locks
Read PG 18 manual ↗The view pg_locks provides access to information about the locks held by active processes within the database server.
- Kind
- System views
- Columns in this snapshot
- 16
- Definition source
- English manual
Columns 16
| Column | Type | Description / reference |
|---|---|---|
locktype | text | Type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, spectoken, object, userlock, advisory, or applytransaction. (See also Table 27.11.) |
database | oid | OID of the database in which the lock target exists, or zero if the target is a shared object, or null if the target is a transaction ID pg_database.oid |
relation | oid | OID of the relation targeted by the lock, or null if the target is not a relation or part of a relation pg_class.oid |
page | int4 | Page number targeted by the lock within the relation, or null if the target is not a relation page or tuple |
tuple | int2 | Tuple number targeted by the lock within the page, or null if the target is not a tuple |
virtualxid | text | Virtual ID of the transaction targeted by the lock, or null if the target is not a virtual transaction ID; see Chapter 67 |
transactionid | xid | ID of the transaction targeted by the lock, or null if the target is not a transaction ID; Chapter 67 |
classid | oid | OID of the system catalog containing the lock target, or null if the target is not a general database object pg_class.oid |
objid | oid | OID of the lock target within its system catalog, or null if the target is not a general database object |
objsubid | int2 | Column number targeted by the lock (the classid and objid refer to the table itself), or zero if the target is some other general database object, or null if the target is not a general database object |
virtualtransaction | text | Virtual ID of the transaction that is holding or awaiting this lock |
pid | int4 | Process ID of the server process holding or awaiting this lock, or null if the lock is held by a prepared transaction |
mode | text | Name of the lock mode held or desired by this process (see Section 13.3.1 and Section 13.2.3) |
granted | bool | True if lock is held, false if lock is awaited |
fastpath | bool | True if lock was taken via fast path, false if taken via main lock table |
waitstart | timestamptz | Time when the server process started waiting for this lock, or null if the lock is held. Note that this can be null for a very short period of time after the wait started even though granted is false. |
Column history across versions
| Column | 9.0 | 9.1 | 9.2 | 9.3 | 9.4 | 9.5 | 9.6 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
locktype | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
database | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
relation | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
page | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
tuple | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
virtualxid | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
transactionid | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
classid | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
objid | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
objsubid | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
virtualtransaction | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
pid | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
mode | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
granted | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
fastpath | · | · | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
waitstart | · | · | · | · | · | · | · | · | · | · | · | ● | ● | ● | ● | ● | ● | ● |
Version history 11
- PG 19 → 20changed
- PG 17 → 18changed
- PG 16 → 17changed
- PG 15 → 16changed
- PG 13 → 14changed
- PG 12 → 13changed
- PG 9.6 → 10changed
- PG 9.5 → 9.6changed
- PG 9.4 → 9.5changed
- PG 9.1 → 9.2changed
- PG 9.0 → 9.1changed
Definition snapshot: english-manuals:85c80c6c7d1eb4b87aa5a49fffe… · English manual source