Updated on 2024-12-18 GMT+08:00

PGXC_LWLOCKS

PGXC_LWLOCK offers details on lightweight locks that are currently held or being waited for by all instances in the cluster. This view is supported only by 9.1.0.200 and later cluster versions.

Table 1 PGXC_LWLOCKS columns

Name

Type

Description

nodename

name

Name of the node where the locked object resides

pid

bigint

ID of the backend thread

query_id

bigint

ID of a query

lwtid

integer

Lightweight thread ID of the backend thread

reqlockid

integer

ID of the lightweight lock that is being requested by the current thread

reqlock

text

Name of the lightweight lock corresponding to reqlockid

heldlocknums

integer

Number of lightweight locks obtained by the current thread

heldlockid

integer

Lightweight lock ID obtained by the current thread

heldlock

text

Name of the lightweight lock corresponding to heldlockid

heldlockmode

text

Lightweight lock mode corresponding to heldlockid

Example

Use the PGXC_LWLOCKS view to get details on lightweight locks that are currently held or being waited for by all instances in the cluster.
1
2
3
4
5
6
7
8
SELECT * FROM pgxc_lwlocks;
 nodename  |       pid       |     query_id      | lwtid | reqlockid | reqlock | heldlocknums | heldlockid |      heldlock      | heldlockmode
-----------+-----------------+-------------------+-------+-----------+---------+--------------+------------+--------------------+--------------
 datanode1 | 139810224193360 | 78250043525924188 | 54844 |           |         |            1 |      76390 | BUFFER_POOL_LWLOCK | Shared
 datanode1 | 139810224198200 | 78250043525924886 | 54922 |           |         |            1 |     957438 | PGPROC_LWLOCK      | Exclusive
 datanode2 | 140262654050288 |                 0 | 54832 |           |         |            1 |          7 | WALWriteLock       | Exclusive
 datanode2 | 140262654052488 | 78250043525923195 | 54847 |           |         |            1 |      15862 | BUFFER_POOL_LWLOCK | Shared
(4 rows)