更新时间:2025-09-18 GMT+08:00

状态信息函数

pgxc_query_wait_status(session_id)

描述:用于查看指定会话的执行单元线程之间的等待状态。

返回值类型:record

函数返回信息如下:

表1 pgxc_query_wait_status(session_id)字段

名称

类型

描述

actor_name

text

actor的名称。

actor_id

text

actor的id。

actor_ip

text

actor的ip。

db_name

text

数据库名称。

thread_name

text

线程名称。

query_id

bigint

查询id。

tid

bigint

当前线程的线程号。

lwtid

integer

当前线程的轻量级线程号。

ptid

integer

streaming线程的父线程。

tlevel

integer

streaming线程的层级。

smpid

integer

并行线程的id。

wait_status

text

当前线程的等待状态。

wait_event

text

如果wait_status是acquire lock、acquire lwlock、wait io三种类型,此列描述具体的锁、轻量级锁、IO的信息。否则为空。

示例:

1
2
3
4
5
6
7
SELECT * FROM pgxc_query_wait_status(139775106588720);
  actor_name  |                   actor_id                   |  actor_ip   | db_name | thread_name |     query_id      |       tid       |  lwtid  | ptid | tlevel | smpid | wait_status | wait_event

--------------+----------------------------------------------+-------------+---------+-------------+-------------------+-----------------+---------+------+--------+-------+-------------+-----------
-
 coordinator1 | runtime-c7010000-0000-4000-8bad-1509e41e3b67 | 10.42.0.240 |         | gsql        | 72339069014638600 | 140406720987184 | 4194244 |      |      0 |     0 | none        |
(1 row)

yr_api_status()

描述:用于查看会话过程中YR接口调用的统计信息。

返回值类型:record

函数返回信息如下:

表2 yr_api_status()字段

名称

类型

描述

actor_name

text

actor的名称。

api

text

接口名称。

total_call

bigint

调用的总次数。

failed_call

bigint

调用失败的次数。

avg_call_during

bigint

平均调用时长。

单位:毫秒

min_call_during

bigint

最小调用时长。

单位:毫秒

max_call_during

bigint

最大调用时长。

单位:毫秒

total_data

bigint

总数据量。

单位:字节

avg_data_rate

bigint

平均数据处理速率。

单位:每毫秒字节数

min_data_rate

bigint

最小数据处理速率。

单位:每毫秒字节数

max_data_rate

bigint

最大数据处理速率。

单位:每毫秒字节数

示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
SELECT * FROM yr_api_status();
  actor_name  |        api         | total_call | failed_call | avg_call_during | min_call_during | max_call_during | total_data | avg_data_rate | min_data_rate | max_data_rate
--------------+--------------------+------------+-------------+-----------------+-----------------+-----------------+------------+---------------+---------------+---------------
 coordinator1 | YR::Invoke         |         12 |           0 |                 |                 |                 |            |               |               |
 coordinator1 | YR::Get            |         11 |           0 |              13 |               1 |             134 |            |               |               |
 coordinator1 | YR::CreateProducer |          0 |           0 |                 |                 |                 |            |               |               |
 coordinator1 | YR::Subscribe      |          0 |           0 |                 |                 |                 |            |               |               |
 coordinator1 | YR::Send           |          0 |           0 |               0 |               0 |               0 |          0 |             0 |             0 |             0
 coordinator1 | YR::Receive        |          0 |           0 |               0 |               0 |               0 |          0 |             0 |             0 |             0
 coordinator1 | YR::KV::Set        |          0 |           0 |               0 |               0 |               0 |          0 |             0 |             0 |             0
 coordinator1 | YR::KV::Get        |          0 |           0 |               0 |               0 |               0 |          0 |             0 |             0 |             0
 coordinator1 | YR::KV::Del        |          0 |           0 |               0 |               0 |               0 |            |               |               |
(9 rows)