Skip to content

SHOW SESSIONS

When a user logs in to the database, a corresponding session will be created and users can query for session information.

The SHOW SESSIONS statement shows the information of all the sessions. It can also show a specified session with its ID.

Precautions

  • The client will call the API release to release the session and clear the session information when you run exit after the operation ends. If you exit the database in an unexpected way and the session timeout duration is not set via session_idle_timeout_secs in nebula-graphd.conf, the session will not be released automatically. For those sessions that are not automatically released, you need to delete them manually (TODO: coding).
  • SHOW SESSIONS queries the session information of all the Graph services.
  • SHOW LOCAL SESSIONS queries the session information of the currently connected Graph service and does not query the session information of other Graph services.
  • SHOW SESSION <Session_Id> queries the session information with a specific session id.

Syntax

SHOW [LOCAL] SESSIONS;
SHOW SESSION <Session_Id>;

Examples

nebula> SHOW SESSIONS;
+------------------+----------+--------------------+----------------------------+----------------------------+------------------+----------+--------------------+
| SessionId        | UserName | SpaceName          | CreateTime                 | UpdateTime                 | GraphAddr        | Timezone | ClientIp           |
+------------------+----------+--------------------+----------------------------+----------------------------+------------------+----------+--------------------+
| 1651220858102296 | "root"   | "basketballplayer" | 2022-04-29T08:27:38.102296 | 2022-04-29T08:50:46.282921 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1651199330300991 | "root"   | "basketballplayer" | 2022-04-29T02:28:50.300991 | 2022-04-29T08:16:28.339038 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1651112899847744 | "root"   | "basketballplayer" | 2022-04-28T02:28:19.847744 | 2022-04-28T08:17:44.470210 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1651041092662100 | "root"   | "basketballplayer" | 2022-04-27T06:31:32.662100 | 2022-04-27T07:01:25.200978 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1650959429593975 | "root"   | "basketballplayer" | 2022-04-26T07:50:29.593975 | 2022-04-26T07:51:47.184810 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1650958897679595 | "root"   | ""                 | 2022-04-26T07:41:37.679595 | 2022-04-26T07:41:37.683802 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
+------------------+----------+--------------------+----------------------------+----------------------------+------------------+----------+--------------------+

nebula> SHOW SESSION 1635254859271703;
+------------------+----------+--------------------+----------------------------+----------------------------+------------------+----------+--------------------+
| SessionId        | UserName | SpaceName          | CreateTime                 | UpdateTime                 | GraphAddr        | Timezone | ClientIp           |
+------------------+----------+--------------------+----------------------------+----------------------------+------------------+----------+--------------------+
| 1651220858102296 | "root"   | "basketballplayer" | 2022-04-29T08:27:38.102296 | 2022-04-29T08:50:54.254384 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
+------------------+----------+--------------------+----------------------------+----------------------------+------------------+----------+--------------------+
Parameter Description
SessionId The session ID, namely the identifier of a session.
UserName The username in a session.
SpaceName The name of the graph space that the user uses currently. It is null ("") when you first log in because there is no specified graph space.
CreateTime The time when the session is created, namely the time when the user logs in. The time zone is specified by timezone_name in the configuration file.
UpdateTime The system will update the time when there is an operation. The time zone is specified by timezone_name in the configuration file.
GraphAddr The IP address and port of the Graph server that hosts the session.
Timezone A reserved parameter that has no specified meaning for now.
ClientIp The IP address of the client.

Last update: February 1, 2023