Updated on 2024-06-03 GMT+08:00

V$LOCK

V$LOCK displays information about locks held by open transactions. By default, only the system administrator can access the system view. Common users must be authorized to access the system view. This view exists in the PG_CATALOG and SYS schemas.

Table 1 V$LOCK columns

Name

Type

Description

addr

raw

Not supported. Set it to NULL.

kaddr

raw

Not supported. Set it to NULL.

sid

number

ID of the session that owns the lock.

type

varchar(2)

TM or TX.

  • TM: corresponding relation lock in pg_locks.
  • TX: other locks.

id1

number

  • TM lock: relationId corresponding to the object ID.
  • TX lock: not supported. Set to 0.

id2

number

  • TM lock: The default value is 0.
  • TX lock: not supported. Set to 0.

lmode

number

For details, see Table 2.

request

number

For details, see Table 2.

ctime

number

Not supported. Set it to NULL.

block

number

Specifies whether it is blocked by other sessions. The value 1 indicates yes, and the value 0 indicates no.

con_id

number

Not supported. Set it to NULL.

blocksid

bigint

ID of another thread blocked by the current thread.

Table 2 Lock mode

Level

GaussDB

-

NULL

0

INVALID

1

AccessShare

2

RowShare

3

RowExclusive

4

ShareUpdateExclusive

5

Share

6

ShareRowExclusive

7

Exclusive

8

AccessExclusive