Syntax
CONNECTION_ID()
Purpose
You can call this function to return the SESSION_ID of the current session. SESSION_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 (0.00 sec)
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 (0.01 sec)