In MySQL, we can use the PS_THREAD_ID()
function to get the Performance Schema thread ID assigned to a given connection ID. This can be useful whenever we use a function that takes the thread ID as its parameter, but we only know the connection ID.
If no thread ID exists for the connection, then NULL
is returned.
The built-in PS_THREAD_ID()
function does the same thing as the now deprecated sys.ps_thread_id()
function. Therefore, we can call the function without needing to qualify it with sys
or making sys
our current schema.