<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="sys-ps-thread-stack">
      </a>
      30.4.5.16 The ps_thread_stack() Function
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045060760816">
  </a>
  <a class="indexterm" name="idm46045060759344">
  </a>
  <p>
   Returns a JSON formatted stack of all statements, stages, and
          events within the Performance Schema for a given thread ID.
  </p>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="sys-ps-thread-stack-parameters">
       </a>
       Parameters
      </h5>
     </div>
    </div>
   </div>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       <code class="literal">
        in_thread_id BIGINT
       </code>
       : The ID of the
                thread to trace. The value should match the
       <code class="literal">
        THREAD_ID
       </code>
       column from some
                Performance Schema
       <a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
        <code class="literal">
         threads
        </code>
       </a>
       table row.
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        in_verbose BOOLEAN
       </code>
       : Whether to
                include
       <code class="literal">
        file:lineno
       </code>
       information in
                the events.
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="sys-ps-thread-stack-return-value">
       </a>
       Return Value
      </h5>
     </div>
    </div>
   </div>
   <p>
    A
    <code class="literal">
     LONGTEXT CHARACTER SET latin1
    </code>
    value.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="sys-ps-thread-stack-example">
       </a>
       Example
      </h5>
     </div>
    </div>
   </div>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa77661385"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> sys<span class="token punctuation">.</span>ps_thread_stack<span class="token punctuation">(</span><span class="token number">37</span><span class="token punctuation">,</span> <span class="token boolean">FALSE</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> thread_stack\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
thread_stack<span class="token punctuation">:</span> {"rankdir"<span class="token punctuation">:</span> "LR","nodesep"<span class="token punctuation">:</span> "0.10",
"stack_created"<span class="token punctuation">:</span> "2014-02-19 13<span class="token punctuation">:</span>39<span class="token punctuation">:</span>03", "mysql_version"<span class="token punctuation">:</span> "8.4.0-tr",
"mysql_user"<span class="token punctuation">:</span> "root@localhost","events"<span class="token punctuation">:</span> [{"nesting_event_id"<span class="token punctuation">:</span> "0",
"event_id"<span class="token punctuation">:</span> "10", "timer_wait"<span class="token punctuation">:</span> 256.35, "event_info"<span class="token punctuation">:</span> "sql/select",
"wait_info"<span class="token punctuation">:</span> "select @@version_comment limit 1\nerrors<span class="token punctuation">:</span> 0\nwarnings<span class="token punctuation">:</span> 0\nlock time<span class="token punctuation">:</span>
...</span></code></pre>
   </div>
  </div>
 </div>
 <br/>
</div>
