<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="sys-ps-thread-id">
      </a>
      30.4.5.15 The ps_thread_id() Function
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045060784384">
  </a>
  <a class="indexterm" name="idm46045060782928">
  </a>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    <a class="link" href="sys-ps-thread-id.html" title="30.4.5.15 The ps_thread_id() Function">
     <code class="literal">
      ps_thread_id()
     </code>
    </a>
    is deprecated,
            and subject to removal in a future MySQL version.
            Applications that use it should be migrated to use the
            built-in
    <a class="link" href="performance-schema-functions.html#function_ps-thread-id">
     <code class="literal">
      PS_THREAD_ID()
     </code>
    </a>
    and
    <a class="link" href="performance-schema-functions.html#function_ps-current-thread-id">
     <code class="literal">
      PS_CURRENT_THREAD_ID()
     </code>
    </a>
    functions instead. See
    <a class="xref" href="performance-schema-functions.html" title="14.21 Performance Schema Functions">
     Section 14.21, “Performance Schema Functions”
    </a>
   </p>
  </div>
  <p>
   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
   <code class="literal">
    NULL
   </code>
   .
  </p>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="sys-ps-thread-id-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_connection_id BIGINT UNSIGNED
       </code>
       : The
                ID of the connection for which to return the thread ID.
                This is a value of the type given in the
       <code class="literal">
        PROCESSLIST_ID
       </code>
       column of the
                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 or the
       <code class="literal">
        Id
       </code>
       column of
       <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
        <code class="literal">
         SHOW PROCESSLIST
        </code>
       </a>
       output.
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="sys-ps-thread-id-return-value">
       </a>
       Return Value
      </h5>
     </div>
    </div>
   </div>
   <p>
    A
    <code class="literal">
     BIGINT UNSIGNED
    </code>
    value.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="sys-ps-thread-id-example">
       </a>
       Example
      </h5>
     </div>
    </div>
   </div>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69682178"><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_id<span class="token punctuation">(</span><span class="token number">260</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<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>
<span class="token output"><span class="token punctuation">|</span> sys.ps_thread_id(260) <span class="token punctuation">|</span></span>
<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>
<span class="token output"><span class="token punctuation">|</span>                   285 <span class="token punctuation">|</span></span>
<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></code></pre>
   </div>
  </div>
 </div>
 <br/>
</div>
