<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="performance-schema-events-statements-history-table">
      </a>
      29.12.6.2 The events_statements_history Table
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045072669696">
  </a>
  <a class="indexterm" name="idm46045072668192">
  </a>
  <p>
   The
   <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>
   table contains the
   <em class="replaceable">
    <code>
     N
    </code>
   </em>
   most recent
          statement events that have ended per thread. Statement events
          are not added to the table until they have ended. When the
          table contains the maximum number of rows for a given thread,
          the oldest thread row is discarded when a new row for that
          thread is added. When a thread ends, all its rows are
          discarded.
  </p>
  <p>
   The Performance Schema autosizes the value of
   <em class="replaceable">
    <code>
     N
    </code>
   </em>
   during server startup. To set the
          number of rows per thread explicitly, set the
   <a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_statements_history_size">
    <code class="literal">
     performance_schema_events_statements_history_size
    </code>
   </a>
   system variable at server startup.
  </p>
  <p>
   The
   <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>
   table has the same columns and indexing as
   <a class="link" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
    <code class="literal">
     events_statements_current
    </code>
   </a>
   . See
   <a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
    Section 29.12.6.1, “The events_statements_current Table”
   </a>
   .
  </p>
  <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
          the
   <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>
   table. It removes the rows.
  </p>
  <p>
   For more information about the relationship between the three
   <code class="literal">
    events_statements_
    <em class="replaceable">
     <code>
      xxx
     </code>
    </em>
   </code>
   event tables, see
   <a class="xref" href="performance-schema-event-tables.html" title="29.9 Performance Schema Tables for Current and Historical Events">
    Section 29.9, “Performance Schema Tables for Current and Historical Events”
   </a>
   .
  </p>
  <p>
   For information about configuring whether to collect statement
          events, see
   <a class="xref" href="performance-schema-statement-tables.html" title="29.12.6 Performance Schema Statement Event Tables">
    Section 29.12.6, “Performance Schema Statement Event Tables”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
