<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="sys-ps-thread-trx-info">
      </a>
      30.4.5.17 The ps_thread_trx_info() Function
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045060742720">
  </a>
  <a class="indexterm" name="idm46045060741248">
  </a>
  <p>
   Returns a JSON object containing information about a given
          thread. The information includes the current transaction, and
          the statements it has already executed, derived from the
          Performance Schema
   <a class="link" href="performance-schema-events-transactions-current-table.html" title="29.12.7.1 The events_transactions_current Table">
    <code class="literal">
     events_transactions_current
    </code>
   </a>
   and
   <a class="link" href="performance-schema-events-statements-history-table.html" title="29.12.6.2 The events_statements_history Table">
    <code class="literal">
     events_statements_history
    </code>
   </a>
   tables.
          (The consumers for those tables must be enabled to obtain full
          data in the JSON object.)
  </p>
  <p>
   If the output exceeds the truncation length (65535 by
          default), a JSON error object is returned, such as:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-json"><div class="docs-select-all right" id="sa57822690"><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-json"><span class="token punctuation">{</span> <span class="token property">"error"</span><span class="token operator">:</span> <span class="token string">"Trx info truncated: Row 6 was cut by GROUP_CONCAT()"</span> <span class="token punctuation">}</span></code></pre>
  </div>
  <p>
   Similar error objects are returned for other warnings and
          exceptions raised during function execution.
  </p>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="sys-ps-thread-trx-info-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 UNSIGNED
       </code>
       : The
                thread ID for which to return transaction information.
                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>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="sys-ps-thread-trx-info-configuration-options">
       </a>
       Configuration Options
      </h5>
     </div>
    </div>
   </div>
   <p>
    <a class="link" href="sys-ps-thread-trx-info.html" title="30.4.5.17 The ps_thread_trx_info() Function">
     <code class="literal">
      ps_thread_trx_info()
     </code>
    </a>
    operation
            can be modified using the following configuration options or
            their corresponding user-defined variables (see
    <a class="xref" href="sys-sys-config.html" title="30.4.2.1 The sys_config Table">
     Section 30.4.2.1, “The sys_config Table”
    </a>
    ):
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       <code class="literal">
        ps_thread_trx_info.max_length
       </code>
       ,
       <code class="literal">
        @sys.ps_thread_trx_info.max_length
       </code>
      </p>
      <p>
       The maximum length of the output. The default is 65535.
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="sys-ps-thread-trx-info-return-value">
       </a>
       Return Value
      </h5>
     </div>
    </div>
   </div>
   <p>
    A
    <code class="literal">
     LONGTEXT
    </code>
    value.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="sys-ps-thread-trx-info-example">
       </a>
       Example
      </h5>
     </div>
    </div>
   </div>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa620448"><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_trx_info<span class="token punctuation">(</span><span class="token number">48</span><span class="token punctuation">)</span>\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>
sys.ps_thread_trx_info(48)<span class="token punctuation">:</span> [
  {
    "time"<span class="token punctuation">:</span> "790.70 us",
    "state"<span class="token punctuation">:</span> "COMMITTED",
    "mode"<span class="token punctuation">:</span> "READ WRITE",
    "autocommitted"<span class="token punctuation">:</span> "NO",
    "gtid"<span class="token punctuation">:</span> "AUTOMATIC",
    "isolation"<span class="token punctuation">:</span> "REPEATABLE READ",
    "statements_executed"<span class="token punctuation">:</span> [
      {
        "sql_text"<span class="token punctuation">:</span> "INSERT INTO info VALUES (1, \'foo\')",
        "time"<span class="token punctuation">:</span> "471.02 us",
        "schema"<span class="token punctuation">:</span> "trx",
        "rows_examined"<span class="token punctuation">:</span> 0,
        "rows_affected"<span class="token punctuation">:</span> 1,
        "rows_sent"<span class="token punctuation">:</span> 0,
        "tmp_tables"<span class="token punctuation">:</span> 0,
        "tmp_disk_tables"<span class="token punctuation">:</span> 0,
        "sort_rows"<span class="token punctuation">:</span> 0,
        "sort_merge_passes"<span class="token punctuation">:</span> 0
      },
      {
        "sql_text"<span class="token punctuation">:</span> "COMMIT",
        "time"<span class="token punctuation">:</span> "254.42 us",
        "schema"<span class="token punctuation">:</span> "trx",
        "rows_examined"<span class="token punctuation">:</span> 0,
        "rows_affected"<span class="token punctuation">:</span> 0,
        "rows_sent"<span class="token punctuation">:</span> 0,
        "tmp_tables"<span class="token punctuation">:</span> 0,
        "tmp_disk_tables"<span class="token punctuation">:</span> 0,
        "sort_rows"<span class="token punctuation">:</span> 0,
        "sort_merge_passes"<span class="token punctuation">:</span> 0
      }
    ]
  },
  {
    "time"<span class="token punctuation">:</span> "426.20 us",
    "state"<span class="token punctuation">:</span> "COMMITTED",
    "mode"<span class="token punctuation">:</span> "READ WRITE",
    "autocommitted"<span class="token punctuation">:</span> "NO",
    "gtid"<span class="token punctuation">:</span> "AUTOMATIC",
    "isolation"<span class="token punctuation">:</span> "REPEATABLE READ",
    "statements_executed"<span class="token punctuation">:</span> [
      {
        "sql_text"<span class="token punctuation">:</span> "INSERT INTO info VALUES (2, \'bar\')",
        "time"<span class="token punctuation">:</span> "107.33 us",
        "schema"<span class="token punctuation">:</span> "trx",
        "rows_examined"<span class="token punctuation">:</span> 0,
        "rows_affected"<span class="token punctuation">:</span> 1,
        "rows_sent"<span class="token punctuation">:</span> 0,
        "tmp_tables"<span class="token punctuation">:</span> 0,
        "tmp_disk_tables"<span class="token punctuation">:</span> 0,
        "sort_rows"<span class="token punctuation">:</span> 0,
        "sort_merge_passes"<span class="token punctuation">:</span> 0
      },
      {
        "sql_text"<span class="token punctuation">:</span> "COMMIT",
        "time"<span class="token punctuation">:</span> "213.23 us",
        "schema"<span class="token punctuation">:</span> "trx",
        "rows_examined"<span class="token punctuation">:</span> 0,
        "rows_affected"<span class="token punctuation">:</span> 0,
        "rows_sent"<span class="token punctuation">:</span> 0,
        "tmp_tables"<span class="token punctuation">:</span> 0,
        "tmp_disk_tables"<span class="token punctuation">:</span> 0,
        "sort_rows"<span class="token punctuation">:</span> 0,
        "sort_merge_passes"<span class="token punctuation">:</span> 0
      }
    ]
  }
]</span></code></pre>
   </div>
  </div>
 </div>
 <br/>
</div>
