跳转至

SHOW QUERIES

SHOW QUERIES语句可以查看当前 Session 中正在执行的查询请求信息。

Note

如果需要终止查询,请参见终止查询

注意事项

  • SHOW LOCAL QUERIES从本地缓存获取当前 Session 中查询的状态,几乎没有延迟。
  • SHOW QUERIES从 Meta 服务获取所有 Session 中的查询信息。这些信息会根据参数session_reclaim_interval_secs定义的周期同步到 Meta 服务,因此在客户端获取到的信息可能属于上个同步周期。

语法

SHOW [LOCAL] QUERIES;

示例

nebula> SHOW LOCAL QUERIES;
+------------------+-----------------+--------+----------------------+----------------------------+----------------+-----------+-----------------------+
| SessionID        | ExecutionPlanID | User   | Host                 | StartTime                  | DurationInUSec | Status    | Query                 |
+------------------+-----------------+--------+----------------------+----------------------------+----------------+-----------+-----------------------+
| 1625463842921750 | 46              | "root" | ""192.168.x.x":9669" | 2021-07-05T05:44:19.502903 | 0              | "RUNNING" | "SHOW LOCAL QUERIES;" |
+------------------+-----------------+--------+----------------------+----------------------------+----------------+-----------+-----------------------+

nebula> SHOW QUERIES;
+------------------+-----------------+---------+----------------------+----------------------------+----------------+-----------+---------------------------------------------------------+
| SessionID        | ExecutionPlanID | User    | Host                 | StartTime                  | DurationInUSec | Status    | Query                                                   |
+------------------+-----------------+---------+----------------------+----------------------------+----------------+-----------+---------------------------------------------------------+
| 1625456037718757 | 54              | "user1" | ""192.168.x.x":9669" | 2021-07-05T05:51:08.691318 | 1504502        | "RUNNING" | "MATCH p=(v:player)-[*1..4]-(v2) RETURN v2 AS Friends;" |
+------------------+-----------------+---------+----------------------+----------------------------+----------------+-----------+---------------------------------------------------------+

# 返回耗时 TOP 10 的查询。
nebula> SHOW QUERIES | ORDER BY $-.DurationInUSec DESC | LIMIT 10;
+------------------+-----------------+---------+----------------------+----------------------------+----------------+-----------+-------------------------------------------------------+
| SessionID        | ExecutionPlanID | User    | Host                 | StartTime                  | DurationInUSec | Status    | Query                                                 |
+------------------+-----------------+---------+----------------------+----------------------------+----------------+-----------+-------------------------------------------------------+
| 1625471375320831 | 98              | "user2" | ""192.168.x.x":9669" | 2021-07-05T07:50:24.461779 | 2608176        | "RUNNING" | "MATCH (v:player)-[*1..4]-(v2) RETURN v2 AS Friends;" |
| 1625456037718757 | 99              | "user1" | ""192.168.x.x":9669" | 2021-07-05T07:50:24.910616 | 2159333        | "RUNNING" | "MATCH (v:player)-[*1..4]-(v2) RETURN v2 AS Friends;" |
+------------------+-----------------+---------+----------------------+----------------------------+----------------+-----------+-------------------------------------------------------+

参数说明如下。

参数 说明
SessionID 会话 ID。
ExecutionPlanID 执行计划 ID。
User 执行查询的用户名。
Host 用户连接的服务器地址和端口。
StartTime 执行查询的开始时间。
DurationInUSec 执行查询的持续时长。单位:微秒。
Status 查询的当前状态。
Query 查询语句。

最后更新: January 31, 2024