In MySQL, we can use the PS_CURRENT_THREAD_ID()
function to get the Performance Schema thread ID assigned to the current connection.
The PS_CURRENT_THREAD_ID()
function was added in MySQL 8.0.16, and it does the same thing as PS_THREAD_ID(CONNECTION_ID())
.