Syntax
CONNECTION_ID()
Purpose
This function returns the Client Session ID of the current session. This ID uniquely identifies the session on the 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 also use the SHOW PROCESSLIST statement to query the number of sessions and their IDs in the current database. For more information, see View tenant sessions.
