Skip to content

SHOW QUERIES

The SHOW QUERIES statement shows the information of working queries in the current session.

Note

To terminate queries, see Kill Query.

Precautions

  • The SHOW QUERIES statement gets the status of queries in the current session from the local cache with almost no latency.
  • The SHOW ALL QUERIES statement gets the information of queries in all the sessions from the Meta Service. The information will be synchronized to the Meta Service according to the interval defined by session_reclaim_interval_secs. Therefore the information that you get from the client may belong to the last synchronization interval.

Syntax

SHOW [ALL] QUERIES;

Examples

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;" |
+------------------+-----------------+---------+----------------------+----------------------------+----------------+-----------+---------------------------------------------------------+

# The following statement returns the top 10 queries that have the longest duration.
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;" |
+------------------+-----------------+---------+----------------------+----------------------------+----------------+-----------+-------------------------------------------------------+

The descriptions are as follows.

Parameter Description
SessionID The session ID.
ExecutionPlanID The ID of the execution plan.
User The username that executes the query.
Host The IP address and port of the Graph server that hosts the session.
StartTime The time when the query starts.
DurationInUSec The duration of the query. The unit is microsecond.
Status The current status of the query.
Query The query statement.

Last update: March 13, 2023