Declaration
CONNECTION_ID()
Description
This function returns the Client Session ID of the current session, which is the unique identifier for the session on the client side.
Examples
Gets 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 execute the SHOW PROCESSLIST statement to query the number of sessions and session IDs in the current database. For more information, see View tenant sessions.