跳转至

SHOW QUERIESGraph

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

Note

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

注意事项Graph

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

语法Graph

SHOW [ALL] QUERIES;

示例Graph

nebula> SHOW 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 QUERIES;" |
+------------------+-----------------+--------+----------------------+----------------------------+----------------+-----------+-----------------+

nebula> SHOW ALL 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 ALL 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 查询语句。

最后更新: October 27, 2021
Back to top