<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="performance-schema-transaction-summary-tables">
      </a>
      29.12.20.5 Transaction Summary Tables
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045068654160">
  </a>
  <a class="indexterm" name="idm46045068652704">
  </a>
  <a class="indexterm" name="idm46045068651184">
  </a>
  <a class="indexterm" name="idm46045068649664">
  </a>
  <a class="indexterm" name="idm46045068648144">
  </a>
  <a class="indexterm" name="idm46045068646608">
  </a>
  <a class="indexterm" name="idm46045068645072">
  </a>
  <a class="indexterm" name="idm46045068643552">
  </a>
  <a class="indexterm" name="idm46045068642032">
  </a>
  <a class="indexterm" name="idm46045068640512">
  </a>
  <p>
   The Performance Schema maintains tables for collecting current
          and recent transaction events, and aggregates that information
          in summary tables.
   <a class="xref" href="performance-schema-transaction-tables.html" title="29.12.7 Performance Schema Transaction Tables">
    Section 29.12.7, “Performance Schema Transaction Tables”
   </a>
   describes the events on which transaction summaries are based.
          See that discussion for information about the content of
          transaction events, the current and historical transaction
          event tables, and how to control transaction event collection,
          which is disabled by default.
  </p>
  <p>
   Example transaction event summary information:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92247587"><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> <span class="token operator">*</span>
       <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_transactions_summary_global_by_event_name
       <span class="token keyword">LIMIT</span> <span class="token number">1</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>
          EVENT_NAME<span class="token punctuation">:</span> transaction
          COUNT_STAR<span class="token punctuation">:</span> 5
      SUM_TIMER_WAIT<span class="token punctuation">:</span> 19550092000
      MIN_TIMER_WAIT<span class="token punctuation">:</span> 2954148000
      AVG_TIMER_WAIT<span class="token punctuation">:</span> 3910018000
      MAX_TIMER_WAIT<span class="token punctuation">:</span> 5486275000
    COUNT_READ_WRITE<span class="token punctuation">:</span> 5
SUM_TIMER_READ_WRITE<span class="token punctuation">:</span> 19550092000
MIN_TIMER_READ_WRITE<span class="token punctuation">:</span> 2954148000
AVG_TIMER_READ_WRITE<span class="token punctuation">:</span> 3910018000
MAX_TIMER_READ_WRITE<span class="token punctuation">:</span> 5486275000
     COUNT_READ_ONLY<span class="token punctuation">:</span> 0
 SUM_TIMER_READ_ONLY<span class="token punctuation">:</span> 0
 MIN_TIMER_READ_ONLY<span class="token punctuation">:</span> 0
 AVG_TIMER_READ_ONLY<span class="token punctuation">:</span> 0
 MAX_TIMER_READ_ONLY<span class="token punctuation">:</span> 0</span></code></pre>
  </div>
  <p>
   Each transaction summary table has one or more grouping
          columns to indicate how the table aggregates events. Event
          names refer to names of event instruments in the
   <a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
    <code class="literal">
     setup_instruments
    </code>
   </a>
   table:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
       <code class="literal">
        events_transactions_summary_by_account_by_event_name
       </code>
      </a>
      has
      <code class="literal">
       USER
      </code>
      ,
      <code class="literal">
       HOST
      </code>
      , and
      <code class="literal">
       EVENT_NAME
      </code>
      columns. Each row summarizes
              events for a given account (user and host combination) and
              event name.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
       <code class="literal">
        events_transactions_summary_by_host_by_event_name
       </code>
      </a>
      has
      <code class="literal">
       HOST
      </code>
      and
      <code class="literal">
       EVENT_NAME
      </code>
      columns. Each row summarizes
              events for a given host and event name.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
       <code class="literal">
        events_transactions_summary_by_thread_by_event_name
       </code>
      </a>
      has
      <code class="literal">
       THREAD_ID
      </code>
      and
      <code class="literal">
       EVENT_NAME
      </code>
      columns. Each row summarizes
              events for a given thread and event name.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
       <code class="literal">
        events_transactions_summary_by_user_by_event_name
       </code>
      </a>
      has
      <code class="literal">
       USER
      </code>
      and
      <code class="literal">
       EVENT_NAME
      </code>
      columns. Each row summarizes
              events for a given user and event name.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
       <code class="literal">
        events_transactions_summary_global_by_event_name
       </code>
      </a>
      has an
      <code class="literal">
       EVENT_NAME
      </code>
      column. Each row
              summarizes events for a given event name.
     </p>
    </li>
   </ul>
  </div>
  <p>
   Each transaction summary table has these summary columns
          containing aggregated values:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       COUNT_STAR
      </code>
      ,
      <code class="literal">
       SUM_TIMER_WAIT
      </code>
      ,
      <code class="literal">
       MIN_TIMER_WAIT
      </code>
      ,
      <code class="literal">
       AVG_TIMER_WAIT
      </code>
      ,
      <code class="literal">
       MAX_TIMER_WAIT
      </code>
     </p>
     <p>
      These columns are analogous to the columns of the same
              names in the wait event summary tables (see
      <a class="xref" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
       Section 29.12.20.1, “Wait Event Summary Tables”
      </a>
      ),
              except that the transaction summary tables aggregate
              events from
      <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>
      rather than
      <a class="link" href="performance-schema-events-waits-current-table.html" title="29.12.4.1 The events_waits_current Table">
       <code class="literal">
        events_waits_current
       </code>
      </a>
      . These
              columns summarize read-write and read-only transactions.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       COUNT_READ_WRITE
      </code>
      ,
      <code class="literal">
       SUM_TIMER_READ_WRITE
      </code>
      ,
      <code class="literal">
       MIN_TIMER_READ_WRITE
      </code>
      ,
      <code class="literal">
       AVG_TIMER_READ_WRITE
      </code>
      ,
      <code class="literal">
       MAX_TIMER_READ_WRITE
      </code>
     </p>
     <p>
      These are similar to the
      <code class="literal">
       COUNT_STAR
      </code>
      and
      <code class="literal">
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
       _TIMER_WAIT
      </code>
      columns, but summarize read-write transactions only. The
              transaction access mode specifies whether transactions
              operate in read/write or read-only mode.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       COUNT_READ_ONLY
      </code>
      ,
      <code class="literal">
       SUM_TIMER_READ_ONLY
      </code>
      ,
      <code class="literal">
       MIN_TIMER_READ_ONLY
      </code>
      ,
      <code class="literal">
       AVG_TIMER_READ_ONLY
      </code>
      ,
      <code class="literal">
       MAX_TIMER_READ_ONLY
      </code>
     </p>
     <p>
      These are similar to the
      <code class="literal">
       COUNT_STAR
      </code>
      and
      <code class="literal">
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
       _TIMER_WAIT
      </code>
      columns, but summarize read-only transactions only. The
              transaction access mode specifies whether transactions
              operate in read/write or read-only mode.
     </p>
    </li>
   </ul>
  </div>
  <p>
   The transaction summary tables have these indexes:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
       <code class="literal">
        events_transactions_summary_by_account_by_event_name
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Primary key on (
         <code class="literal">
          USER
         </code>
         ,
         <code class="literal">
          HOST
         </code>
         ,
         <code class="literal">
          EVENT_NAME
         </code>
         )
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
       <code class="literal">
        events_transactions_summary_by_host_by_event_name
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Primary key on (
         <code class="literal">
          HOST
         </code>
         ,
         <code class="literal">
          EVENT_NAME
         </code>
         )
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
       <code class="literal">
        events_transactions_summary_by_thread_by_event_name
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Primary key on (
         <code class="literal">
          THREAD_ID
         </code>
         ,
         <code class="literal">
          EVENT_NAME
         </code>
         )
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
       <code class="literal">
        events_transactions_summary_by_user_by_event_name
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Primary key on (
         <code class="literal">
          USER
         </code>
         ,
         <code class="literal">
          EVENT_NAME
         </code>
         )
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
       <code class="literal">
        events_transactions_summary_global_by_event_name
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Primary key on (
         <code class="literal">
          EVENT_NAME
         </code>
         )
        </p>
       </li>
      </ul>
     </div>
    </li>
   </ul>
  </div>
  <p>
   <a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
    <code class="literal">
     TRUNCATE TABLE
    </code>
   </a>
   is permitted for
          transaction summary tables. It has these effects:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      For summary tables not aggregated by account, host, or
              user, truncation resets the summary columns to zero rather
              than removing rows.
     </p>
    </li>
    <li class="listitem">
     <p>
      For summary tables aggregated by account, host, or user,
              truncation removes rows for accounts, hosts, or users with
              no connections, and resets the summary columns to zero for
              the remaining rows.
     </p>
    </li>
   </ul>
  </div>
  <p>
   In addition, each transaction summary table that is aggregated
          by account, host, user, or thread is implicitly truncated by
          truncation of the connection table on which it depends, or
          truncation of
   <a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
    <code class="literal">
     events_transactions_summary_global_by_event_name
    </code>
   </a>
   .
          For details, see
   <a class="xref" href="performance-schema-connection-tables.html" title="29.12.8 Performance Schema Connection Tables">
    Section 29.12.8, “Performance Schema Connection Tables”
   </a>
   .
  </p>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="transaction-summary-tables-aggregation">
       </a>
       Transaction Aggregation Rules
      </h5>
     </div>
    </div>
   </div>
   <p>
    Transaction event collection occurs without regard to
            isolation level, access mode, or autocommit mode.
   </p>
   <p>
    Transaction event collection occurs for all non-aborted
            transactions initiated by the server, including empty
            transactions.
   </p>
   <p>
    Read-write transactions are generally more resource
            intensive than read-only transactions, therefore transaction
            summary tables include separate aggregate columns for
            read-write and read-only transactions.
   </p>
   <p>
    Resource requirements may also vary with transaction
            isolation level. However, presuming that only one isolation
            level would be used per server, aggregation by isolation
            level is not provided.
   </p>
  </div>
 </div>
 <br/>
</div>
