content_image/709209.jpg
## Example 

## 28.4.5.15 The ps_thread_id() Function 

mysql> SELECT sys.ps_thread_account(sys.ps_thread_id(CONNECTION_ID())); +----------------------------------------------------------+ | sys.ps_thread_account(sys.ps_thread_id(CONNECTION_ID())) | +----------------------------------------------------------+ | root@localhost | +----------------------------------------------------------+ 

<img src='content_image/709209.jpg'>

## 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 . 

## Parameters 

• 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. 

## Return Value 

## Example 

## 28.4.5.16 The ps_thread_stack() Function 

A BIGINT UNSIGNED  value. 

mysql> SELECT sys.ps_thread_id(260); +-----------------------+ | sys.ps_thread_id(260) | +-----------------------+ | 285 | +-----------------------+ 

Returns a JSON formatted stack of all statements, stages, and events within the Performance Schema for a given thread ID. 

## Parameters 

• 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. 

## Return Value 

## Example 

A LONGTEXT CHARACTER SET latin1  value. 

mysql> SELECT sys.ps_thread_stack(37, FALSE) AS thread_stack\G 

