mysql 获取连接id与线程id
1.获取当前session的连接ID
mysql> select connection_id();
+-----------------+
| connection_id() |
+-----------------+
| 121 |
+-----------------+
1 row in set (0.00 sec)
2.获取当前session的线程id
mysql> select ps_current_thread_id();
+------------------------+
| ps_current_thread_id() |
+------------------------+
| 180 |
+------------------------+
1 row in set (0.00 sec)
一般情况下一个连接id对应一个线程id