sys Schema Stored Functions Example mysql>  SELECT sys.ps_thread_account(sys.ps_thread_id(CONNECTION_ID())); +----------------------------------------------------------+ | sys.ps_thread_account(sys.ps_thread_id(CONNECTION_ID())) | +----------------------------------------------------------+ | root@localhost | +----------------------------------------------------------+ 28.4.5.15 The ps_thread_id() Function Note As of MySQL 8.0.16,  ps_thread_id()  is deprecated; expect it to be removed in a future version of MySQL. Applications that use it should be migrated to use the built-in  PS_THREAD_ID()  and  PS_CURRENT_THREAD_ID()  functions instead. See Section 12.22, “Performance Schema Functions” Returns the Performance Schema thread ID assigned to a given connection ID, or the thread ID for the current connection if the connection ID is  NULL . • in_connection_id BIGINT UNSIGNED : The ID of the connection for which to return the thread ID. This is a value of the type given in the  PROCESSLIST_ID  column of the Performance Schema  threads table or the  Id  column of  SHOW PROCESSLIST  output. Parameters Return Value Example 28.4.5.16 The ps_thread_stack() Function Parameters Return Value Example mysql>  SELECT sys.ps_thread_stack(37, FALSE) AS thread_stack\G 5209 A  LONGTEXT CHARACTER SET latin1  value. • in_thread_id BIGINT : The ID of the thread to trace. The value should match the  THREAD_ID column from some Performance Schema  threads  table row. • in_verbose BOOLEAN : Whether to include  file:lineno  information in the events. Returns a JSON formatted stack of all statements, stages, and events within the Performance Schema for a given thread ID. mysql>  SELECT sys.ps_thread_id(260); +-----------------------+ | sys.ps_thread_id(260) | +-----------------------+ | 285 | +-----------------------+ A  BIGINT UNSIGNED  value.