Can users view their own session_id connected to TiDB?

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 用户可以查看自己连接到tidb的session_id吗

| username: zhanggame1

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version] v7.1
[Reproduction Path] What operations were performed to encounter the issue
[Encountered Issue: Issue Phenomenon and Impact]
We can view the session_id of TiDB connections through show processlist. Can each connection check its own session_id?

| username: DBRE | Original post link

| username: zhanggame1 | Original post link

This is possible. Additionally, can you know which TiDB you are connected to?

| username: 裤衩儿飞上天 | Original post link

| username: 啦啦啦啦啦 | Original post link

Combine the two SQL statements above:

select * from INFORMATION_SCHEMA.CLUSTER_PROCESSLIST where id=(select connection_id());
| username: zhanggame1 | Original post link

Indeed, it’s very useful.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.