Syntax
CONNECTION_ID()
Purpose
CONNECTION_ID() returns the session_id of the current session. This ID is the unique identifier of a session in a client.
You can execute the SHOW PROCESSLIST statement to query the quantity and IDs of sessions in the current database.
Examples
obclient> select CONNECTION_ID();
+-----------------+
| CONNECTION_ID() |
+-----------------+
| 3221638476 |
+-----------------+
1 row in set
obclient> SELECT session_id,trans_id FROM oceanbase.__all_virtual_trans_stat WHERE session_id=CONNECTION_ID();
+------------+------------------------------------------------------------------------------------------+
| session_id | trans_id |
+------------+------------------------------------------------------------------------------------------+
| 3221638476 | {hash:6868349667767780996, inc:95279944, addr:"xxx.xxx.xx.xxx:xxxx", t:1626333606027937} |
+------------+------------------------------------------------------------------------------------------+
1 row in set