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           |
+------------------+----------+--------------------+----------------------------+----------------------------+------------------+----------+--------------------+
| 1635128818397714 | "root"   | "test"             | 2021-10-25T02:26:58.397714 | 2021-10-25T08:31:31.846846 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1635254859271703 | "root"   | "basketballplayer" | 2021-10-26T13:27:39.271703 | 2021-10-26T13:51:38.277704 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1634871229727322 | "root"   | "basketballplayer" | 2021-10-22T02:53:49.727322 | 2021-10-22T02:53:56.564001 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1635750725840229 | "root"   | "basketballplayer" | 2021-11-01T07:12:05.840229 | 2021-11-01T09:42:36.883617 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1635299224732060 | "root"   | "basketballplayer" | 2021-10-27T01:47:04.732060 | 2021-10-27T09:04:31.741126 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1634628999765689 | "root"   | ""                 | 2021-10-19T07:36:39.765689 | 2021-10-19T07:36:39.768064 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1634886296595136 | "root"   | "basketballplayer" | 2021-10-22T07:04:56.595136 | 2021-10-22T09:48:20.299364 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1634629179882439 | "root"   | "basketballplayer" | 2021-10-19T07:39:39.882439 | 2021-10-19T09:34:52.153145 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1635246158961634 | "root"   | "basketballplayer" | 2021-10-26T11:02:38.961634 | 2021-10-26T11:02:51.250897 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
| 1634785346839017 | "root"   | "basketballplayer" | 2021-10-21T03:02:26.839017 | 2021-10-21T11:07:40.911329 | "127.0.0.1:9669" | 0        | "::ffff:127.0.0.1" |
+------------------+----------+--------------------+----------------------------+----------------------------+------------------+----------+--------------------+

nebula> SHOW SESSION 1635254859271703;
+--------------+----------------------------+
| VariableName | Value                      |
+--------------+----------------------------+
| "SessionID"  | 1635254859271703           |
| "UserName"   | "root"                     |
| "SpaceName"  | "basketballplayer"         |
| "CreateTime" | 2021-10-26T13:27:39.271703 |
| "UpdateTime" | 2021-10-26T13:51:38.277704 |
| "GraphAddr"  | "127.0.0.1:9669"           |
| "Timezone"   | 0                          |
| "ClientIp"   | "::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: January 14, 2022
Back to top