Syntax
CONNECTION_ID()
Purpose
CONNECTION_ID() returns the client session ID of the current session. This ID is the unique identifier of a session in a client.
Examples
Obtain the client session ID of the current session.
obclient [(none)]> SELECT CONNECTION_ID() AS Client_Session_ID;
The return result is as follows:
+-------------------+
| Client_Session_ID |
+-------------------+
| 3221488032 |
+-------------------+
1 row in set
References
You can execute the SHOW PROCESSLIST statement to query the quantity and IDs of sessions in the current database. For more information, see View tenant sessions.