#### 28.4.5.16 The ps\_thread\_stack() Function

[]()[]()

 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`](performance-schema-threads-table.html) table row.

* `in_verbose BOOLEAN`: Whether to include `file:lineno` information in the events.

##### Return Value

 A `LONGTEXT CHARACTER SET latin1` value.

##### Example

```
mysql> SELECT sys.ps_thread_stack(37, FALSE) AS thread_stack\G
*************************** 1. row ***************************
thread_stack: {"rankdir": "LR","nodesep": "0.10",
"stack_created": "2014-02-19 13:39:03", "mysql_version": "8.0.2-dmr-debug-log",
"mysql_user": "root@localhost","events": [{"nesting_event_id": "0",
"event_id": "10", "timer_wait": 256.35, "event_info": "sql/select",
"wait_info": "select @@version_comment limit 1\nerrors: 0\nwarnings: 0\nlock time:
...
```

