<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="general-thread-states">
      </a>
      10.14.3 General Thread States
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045221803744">
  </a>
  <p>
   The following list describes thread
   <code class="literal">
    State
   </code>
   values that are associated with general query processing and not
        more specialized activities such as replication. Many of these
        are useful only for finding bugs in the server.
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221800128">
      </a>
      <a class="indexterm" name="idm46045221798640">
      </a>
      <code class="literal">
       After create
      </code>
     </p>
     <p>
      This occurs when the thread creates a table (including
            internal temporary tables), at the end of the function that
            creates the table. This state is used even if the table
            could not be created due to some error.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221795024">
      </a>
      <a class="indexterm" name="idm46045221793536">
      </a>
      <code class="literal">
       altering table
      </code>
     </p>
     <p>
      The server is in the process of executing an in-place
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER TABLE
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221788880">
      </a>
      <a class="indexterm" name="idm46045221787392">
      </a>
      <code class="literal">
       Analyzing
      </code>
     </p>
     <p>
      The thread is calculating a
      <code class="literal">
       MyISAM
      </code>
      table
            key distributions (for example, for
      <a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
       <code class="literal">
        ANALYZE TABLE
       </code>
      </a>
      ).
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221782000">
      </a>
      <a class="indexterm" name="idm46045221780512">
      </a>
      <code class="literal">
       checking permissions
      </code>
     </p>
     <p>
      The thread is checking whether the server has the required
            privileges to execute the statement.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221777040">
      </a>
      <a class="indexterm" name="idm46045221775552">
      </a>
      <code class="literal">
       Checking table
      </code>
     </p>
     <p>
      The thread is performing a table check operation.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221772128">
      </a>
      <a class="indexterm" name="idm46045221770640">
      </a>
      <code class="literal">
       cleaning up
      </code>
     </p>
     <p>
      The thread has processed one command and is preparing to
            free memory and reset certain state variables.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221767152">
      </a>
      <a class="indexterm" name="idm46045221765664">
      </a>
      <code class="literal">
       closing tables
      </code>
     </p>
     <p>
      The thread is flushing the changed table data to disk and
            closing the used tables. This should be a fast operation. If
            not, verify that you do not have a full disk and that the
            disk is not in very heavy use.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221762048">
      </a>
      <a class="indexterm" name="idm46045221760528">
      </a>
      <code class="literal">
       committing alter table to storage engine
      </code>
     </p>
     <p>
      The server has finished an in-place
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER TABLE
       </code>
      </a>
      and is committing
            the result.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221755792">
      </a>
      <a class="indexterm" name="idm46045221754288">
      </a>
      <code class="literal">
       converting HEAP to ondisk
      </code>
     </p>
     <p>
      The thread is converting an internal temporary table from a
      <code class="literal">
       MEMORY
      </code>
      table to an on-disk table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221750096">
      </a>
      <a class="indexterm" name="idm46045221748608">
      </a>
      <code class="literal">
       copy to tmp table
      </code>
     </p>
     <p>
      The thread is processing an
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER
            TABLE
       </code>
      </a>
      statement. This state occurs after the table
            with the new structure has been created but before rows are
            copied into it.
     </p>
     <p>
      For a thread in this state, the Performance Schema can be
            used to obtain about the progress of the copy operation. See
      <a class="xref" href="performance-schema-stage-tables.html" title="29.12.5 Performance Schema Stage Event Tables">
       Section 29.12.5, “Performance Schema Stage Event Tables”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221742528">
      </a>
      <a class="indexterm" name="idm46045221741040">
      </a>
      <code class="literal">
       Copying to group table
      </code>
     </p>
     <p>
      If a statement has different
      <code class="literal">
       ORDER BY
      </code>
      and
      <code class="literal">
       GROUP BY
      </code>
      criteria, the rows are sorted by
            group and copied to a temporary table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221736128">
      </a>
      <a class="indexterm" name="idm46045221734640">
      </a>
      <code class="literal">
       Copying to tmp table
      </code>
     </p>
     <p>
      The server is copying to a temporary table in memory.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221731216">
      </a>
      <a class="indexterm" name="idm46045221729760">
      </a>
      <code class="literal">
       Copying to tmp table on disk
      </code>
     </p>
     <p>
      The server is copying to a temporary table on disk. The
            temporary result set has become too large (see
      <a class="xref" href="internal-temporary-tables.html" title="10.4.4 Internal Temporary Table Use in MySQL">
       Section 10.4.4, “Internal Temporary Table Use in MySQL”
      </a>
      ). Consequently,
            the thread is changing the temporary table from in-memory to
            disk-based format to save memory.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221725360">
      </a>
      <a class="indexterm" name="idm46045221723872">
      </a>
      <code class="literal">
       Creating index
      </code>
     </p>
     <p>
      The thread is processing
      <code class="literal">
       ALTER TABLE ... ENABLE
            KEYS
      </code>
      for a
      <code class="literal">
       MyISAM
      </code>
      table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221719088">
      </a>
      <a class="indexterm" name="idm46045221717600">
      </a>
      <code class="literal">
       Creating sort index
      </code>
     </p>
     <p>
      The thread is processing a
      <a class="link" href="select.html" title="15.2.13 SELECT Statement">
       <code class="literal">
        SELECT
       </code>
      </a>
      that is resolved using
            an internal temporary table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221712912">
      </a>
      <a class="indexterm" name="idm46045221711424">
      </a>
      <code class="literal">
       creating table
      </code>
     </p>
     <p>
      The thread is creating a table. This includes creation of
            temporary tables.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221707968">
      </a>
      <a class="indexterm" name="idm46045221706480">
      </a>
      <code class="literal">
       Creating tmp table
      </code>
     </p>
     <p>
      The thread is creating a temporary table in memory or on
            disk. If the table is created in memory but later is
            converted to an on-disk table, the state during that
            operation is
      <code class="literal">
       Copying to tmp table on
            disk
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221702160">
      </a>
      <a class="indexterm" name="idm46045221700656">
      </a>
      <code class="literal">
       deleting from main table
      </code>
     </p>
     <p>
      The server is executing the first part of a multiple-table
            delete. It is deleting only from the first table, and saving
            columns and offsets to be used for deleting from the other
            (reference) tables.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221697024">
      </a>
      <a class="indexterm" name="idm46045221695520">
      </a>
      <code class="literal">
       deleting from reference tables
      </code>
     </p>
     <p>
      The server is executing the second part of a multiple-table
            delete and deleting the matched rows from the other tables.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221691984">
      </a>
      <a class="indexterm" name="idm46045221690480">
      </a>
      <code class="literal">
       discard_or_import_tablespace
      </code>
     </p>
     <p>
      The thread is processing an
      <code class="literal">
       ALTER TABLE ... DISCARD
            TABLESPACE
      </code>
      or
      <code class="literal">
       ALTER TABLE ... IMPORT
            TABLESPACE
      </code>
      statement.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221685552">
      </a>
      <a class="indexterm" name="idm46045221684096">
      </a>
      <code class="literal">
       end
      </code>
     </p>
     <p>
      This occurs at the end but before the cleanup of
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER TABLE
       </code>
      </a>
      ,
      <a class="link" href="create-view.html" title="15.1.23 CREATE VIEW Statement">
       <code class="literal">
        CREATE VIEW
       </code>
      </a>
      ,
      <a class="link" href="delete.html" title="15.2.2 DELETE Statement">
       <code class="literal">
        DELETE
       </code>
      </a>
      ,
      <a class="link" href="insert.html" title="15.2.7 INSERT Statement">
       <code class="literal">
        INSERT
       </code>
      </a>
      ,
      <a class="link" href="select.html" title="15.2.13 SELECT Statement">
       <code class="literal">
        SELECT
       </code>
      </a>
      , or
      <a class="link" href="update.html" title="15.2.17 UPDATE Statement">
       <code class="literal">
        UPDATE
       </code>
      </a>
      statements.
     </p>
     <p>
      For the
      <code class="literal">
       end
      </code>
      state, the following
            operations could be happening:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Writing an event to the binary log
        </p>
       </li>
       <li class="listitem">
        <p>
         Freeing memory buffers, including for blobs
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221670080">
      </a>
      <a class="indexterm" name="idm46045221668592">
      </a>
      <code class="literal">
       executing
      </code>
     </p>
     <p>
      The thread has begun executing a statement.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221665184">
      </a>
      <a class="indexterm" name="idm46045221663680">
      </a>
      <code class="literal">
       Execution of init_command
      </code>
     </p>
     <p>
      The thread is executing statements in the value of the
      <code class="literal">
       init_command
      </code>
      system variable.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221659488">
      </a>
      <a class="indexterm" name="idm46045221658000">
      </a>
      <code class="literal">
       freeing items
      </code>
     </p>
     <p>
      The thread has executed a command. This state is usually
            followed by
      <code class="literal">
       cleaning up
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221653840">
      </a>
      <a class="indexterm" name="idm46045221652352">
      </a>
      <code class="literal">
       FULLTEXT initialization
      </code>
     </p>
     <p>
      The server is preparing to perform a natural-language
            full-text search.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221648896">
      </a>
      <a class="indexterm" name="idm46045221647408">
      </a>
      <code class="literal">
       init
      </code>
     </p>
     <p>
      This occurs before the initialization of
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER TABLE
       </code>
      </a>
      ,
      <a class="link" href="delete.html" title="15.2.2 DELETE Statement">
       <code class="literal">
        DELETE
       </code>
      </a>
      ,
      <a class="link" href="insert.html" title="15.2.7 INSERT Statement">
       <code class="literal">
        INSERT
       </code>
      </a>
      ,
      <a class="link" href="select.html" title="15.2.13 SELECT Statement">
       <code class="literal">
        SELECT
       </code>
      </a>
      , or
      <a class="link" href="update.html" title="15.2.17 UPDATE Statement">
       <code class="literal">
        UPDATE
       </code>
      </a>
      statements. Actions
            taken by the server in this state include flushing the
            binary log and the
      <code class="literal">
       InnoDB
      </code>
      log.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221637024">
      </a>
      <a class="indexterm" name="idm46045221635536">
      </a>
      <code class="literal">
       Killed
      </code>
     </p>
     <p>
      Someone has sent a
      <a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
       <code class="literal">
        KILL
       </code>
      </a>
      statement to the thread and it should abort next time it
            checks the kill flag. The flag is checked in each major loop
            in MySQL, but in some cases it might still take a short time
            for the thread to die. If the thread is locked by some other
            thread, the kill takes effect as soon as the other thread
            releases its lock.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221630544">
      </a>
      <a class="indexterm" name="idm46045221629056">
      </a>
      <code class="literal">
       Locking system tables
      </code>
     </p>
     <p>
      The thread is trying to lock a system table (for example, a
            time zone or log table).
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221625584">
      </a>
      <a class="indexterm" name="idm46045221624096">
      </a>
      <code class="literal">
       logging slow query
      </code>
     </p>
     <p>
      The thread is writing a statement to the slow-query log.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221620672">
      </a>
      <a class="indexterm" name="idm46045221619184">
      </a>
      <code class="literal">
       login
      </code>
     </p>
     <p>
      The initial state for a connection thread until the client
            has been authenticated successfully.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221615712">
      </a>
      <a class="indexterm" name="idm46045221614224">
      </a>
      <code class="literal">
       manage keys
      </code>
     </p>
     <p>
      The server is enabling or disabling a table index.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221610800">
      </a>
      <a class="indexterm" name="idm46045221609312">
      </a>
      <code class="literal">
       Opening system tables
      </code>
     </p>
     <p>
      The thread is trying to open a system table (for example, a
            time zone or log table).
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221605840">
      </a>
      <a class="indexterm" name="idm46045221604352">
      </a>
      <code class="literal">
       Opening tables
      </code>
     </p>
     <p>
      The thread is trying to open a table. This is should be very
            fast procedure, unless something prevents opening. For
            example, an
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER TABLE
       </code>
      </a>
      or a
      <a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
       <code class="literal">
        LOCK
            TABLE
       </code>
      </a>
      statement can prevent opening a table until
            the statement is finished. It is also worth checking that
            your
      <a class="link" href="server-system-variables.html#sysvar_table_open_cache">
       <code class="literal">
        table_open_cache
       </code>
      </a>
      value
            is large enough.
     </p>
     <p>
      For system tables, the
      <code class="literal">
       Opening system
            tables
      </code>
      state is used instead.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221595824">
      </a>
      <a class="indexterm" name="idm46045221594336">
      </a>
      <code class="literal">
       optimizing
      </code>
     </p>
     <p>
      The server is performing initial optimizations for a query.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221590912">
      </a>
      <a class="indexterm" name="idm46045221589424">
      </a>
      <code class="literal">
       preparing
      </code>
     </p>
     <p>
      This state occurs during query optimization.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221586016">
      </a>
      <a class="indexterm" name="idm46045221584512">
      </a>
      <code class="literal">
       preparing for alter table
      </code>
     </p>
     <p>
      The server is preparing to execute an in-place
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER TABLE
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221579824">
      </a>
      <a class="indexterm" name="idm46045221578336">
      </a>
      <code class="literal">
       Purging old relay logs
      </code>
     </p>
     <p>
      The thread is removing unneeded relay log files.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221574912">
      </a>
      <a class="indexterm" name="idm46045221573424">
      </a>
      <code class="literal">
       query end
      </code>
     </p>
     <p>
      This state occurs after processing a query but before the
      <code class="literal">
       freeing items
      </code>
      state.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221569280">
      </a>
      <a class="indexterm" name="idm46045221567792">
      </a>
      <code class="literal">
       Receiving from client
      </code>
     </p>
     <p>
      The server is reading a packet from the client.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221564384">
      </a>
      <a class="indexterm" name="idm46045221562896">
      </a>
      <code class="literal">
       Removing duplicates
      </code>
     </p>
     <p>
      The query was using
      <a class="link" href="select.html" title="15.2.13 SELECT Statement">
       <code class="literal">
        SELECT
            DISTINCT
       </code>
      </a>
      in such a way that MySQL could not
            optimize away the distinct operation at an early stage.
            Because of this, MySQL requires an extra stage to remove all
            duplicated rows before sending the result to the client.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221558016">
      </a>
      <a class="indexterm" name="idm46045221556528">
      </a>
      <code class="literal">
       removing tmp table
      </code>
     </p>
     <p>
      The thread is removing an internal temporary table after
            processing a
      <a class="link" href="select.html" title="15.2.13 SELECT Statement">
       <code class="literal">
        SELECT
       </code>
      </a>
      statement. This state is not used if no temporary table was
            created.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221551760">
      </a>
      <a class="indexterm" name="idm46045221550272">
      </a>
      <code class="literal">
       rename
      </code>
     </p>
     <p>
      The thread is renaming a table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221546880">
      </a>
      <a class="indexterm" name="idm46045221545392">
      </a>
      <code class="literal">
       rename result table
      </code>
     </p>
     <p>
      The thread is processing an
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER
            TABLE
       </code>
      </a>
      statement, has created the new table, and is
            renaming it to replace the original table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221540672">
      </a>
      <a class="indexterm" name="idm46045221539184">
      </a>
      <code class="literal">
       Reopen tables
      </code>
     </p>
     <p>
      The thread got a lock for the table, but noticed after
            getting the lock that the underlying table structure
            changed. It has freed the lock, closed the table, and is
            trying to reopen it.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221535600">
      </a>
      <a class="indexterm" name="idm46045221534112">
      </a>
      <code class="literal">
       Repair by sorting
      </code>
     </p>
     <p>
      The repair code is using a sort to create indexes.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221530688">
      </a>
      <a class="indexterm" name="idm46045221529200">
      </a>
      <code class="literal">
       Repair done
      </code>
     </p>
     <p>
      The thread has completed a multithreaded repair for a
      <code class="literal">
       MyISAM
      </code>
      table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221525056">
      </a>
      <a class="indexterm" name="idm46045221523568">
      </a>
      <code class="literal">
       Repair with keycache
      </code>
     </p>
     <p>
      The repair code is using creating keys one by one through
            the key cache. This is much slower than
      <code class="literal">
       Repair by
            sorting
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221519360">
      </a>
      <a class="indexterm" name="idm46045221517872">
      </a>
      <code class="literal">
       Rolling back
      </code>
     </p>
     <p>
      The thread is rolling back a transaction.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221514464">
      </a>
      <a class="indexterm" name="idm46045221512976">
      </a>
      <code class="literal">
       Saving state
      </code>
     </p>
     <p>
      For
      <code class="literal">
       MyISAM
      </code>
      table operations such as
            repair or analysis, the thread is saving the new table state
            to the
      <code class="filename">
       .MYI
      </code>
      file header. State includes
            information such as number of rows, the
      <code class="literal">
       AUTO_INCREMENT
      </code>
      counter, and key
            distributions.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221507248">
      </a>
      <a class="indexterm" name="idm46045221505744">
      </a>
      <code class="literal">
       Searching rows for update
      </code>
     </p>
     <p>
      The thread is doing a first phase to find all matching rows
            before updating them. This has to be done if the
      <a class="link" href="update.html" title="15.2.17 UPDATE Statement">
       <code class="literal">
        UPDATE
       </code>
      </a>
      is changing the index
            that is used to find the involved rows.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       Sending data
      </code>
     </p>
     <p>
      This state is now included in the
      <code class="literal">
       Executing
      </code>
      state.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221498288">
      </a>
      <a class="indexterm" name="idm46045221496800">
      </a>
      <code class="literal">
       Sending to client
      </code>
     </p>
     <p>
      The server is writing a packet to the client.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221493392">
      </a>
      <a class="indexterm" name="idm46045221491904">
      </a>
      <code class="literal">
       setup
      </code>
     </p>
     <p>
      The thread is beginning an
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER
            TABLE
       </code>
      </a>
      operation.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221487280">
      </a>
      <a class="indexterm" name="idm46045221485792">
      </a>
      <code class="literal">
       Sorting for group
      </code>
     </p>
     <p>
      The thread is doing a sort to satisfy a
      <code class="literal">
       GROUP
            BY
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221481680">
      </a>
      <a class="indexterm" name="idm46045221480192">
      </a>
      <code class="literal">
       Sorting for order
      </code>
     </p>
     <p>
      The thread is doing a sort to satisfy an
      <code class="literal">
       ORDER
            BY
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221476080">
      </a>
      <a class="indexterm" name="idm46045221474592">
      </a>
      <code class="literal">
       Sorting index
      </code>
     </p>
     <p>
      The thread is sorting index pages for more efficient access
            during a
      <code class="literal">
       MyISAM
      </code>
      table optimization
            operation.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221470400">
      </a>
      <a class="indexterm" name="idm46045221468912">
      </a>
      <code class="literal">
       Sorting result
      </code>
     </p>
     <p>
      For a
      <a class="link" href="select.html" title="15.2.13 SELECT Statement">
       <code class="literal">
        SELECT
       </code>
      </a>
      statement, this
            is similar to
      <code class="literal">
       Creating sort index
      </code>
      , but
            for nontemporary tables.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221463536">
      </a>
      <a class="indexterm" name="idm46045221462048">
      </a>
      <code class="literal">
       starting
      </code>
     </p>
     <p>
      The first stage at the beginning of statement execution.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221458624">
      </a>
      <a class="indexterm" name="idm46045221457136">
      </a>
      <code class="literal">
       statistics
      </code>
     </p>
     <p>
      The server is calculating statistics to develop a query
            execution plan. If a thread is in this state for a long
            time, the server is probably disk-bound performing other
            work.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221453552">
      </a>
      <a class="indexterm" name="idm46045221452480">
      </a>
      <a class="indexterm" name="idm46045221450992">
      </a>
      <a class="indexterm" name="idm46045221449504">
      </a>
      <code class="literal">
       System lock
      </code>
     </p>
     <p>
      The thread has called
      <code class="literal">
       mysql_lock_tables()
      </code>
      and the thread state has not been updated since. This is a
            very general state that can occur for many reasons.
     </p>
     <p>
      For example, the thread is going to request or is waiting
            for an internal or external system lock for the table. This
            can occur when
      <a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
       <code class="literal">
        InnoDB
       </code>
      </a>
      waits for
            a table-level lock during execution of
      <a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
       <code class="literal">
        LOCK TABLES
       </code>
      </a>
      . If this state is
            being caused by requests for external locks and you are not
            using multiple
      <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
       <span class="command">
        <strong>
         mysqld
        </strong>
       </span>
      </a>
      servers that are
            accessing the same
      <a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
       <code class="literal">
        MyISAM
       </code>
      </a>
      tables, you can disable external system locks with the
      <a class="link" href="server-options.html#option_mysqld_external-locking">
       <code class="option">
        --skip-external-locking
       </code>
      </a>
      option. However, external locking is disabled by default, so
            it is likely that this option has no effect. For
      <a class="link" href="show-profile.html" title="15.7.7.32 SHOW PROFILE Statement">
       <code class="literal">
        SHOW PROFILE
       </code>
      </a>
      , this state
            means the thread is requesting the lock (not waiting for
            it).
     </p>
     <p>
      For system tables, the
      <code class="literal">
       Locking system
            tables
      </code>
      state is used instead.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221435888">
      </a>
      <a class="indexterm" name="idm46045221434400">
      </a>
      <code class="literal">
       update
      </code>
     </p>
     <p>
      The thread is getting ready to start updating the table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221430976">
      </a>
      <a class="indexterm" name="idm46045221429488">
      </a>
      <code class="literal">
       Updating
      </code>
     </p>
     <p>
      The thread is searching for rows to update and is updating
            them.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221426048">
      </a>
      <a class="indexterm" name="idm46045221424560">
      </a>
      <code class="literal">
       updating main table
      </code>
     </p>
     <p>
      The server is executing the first part of a multiple-table
            update. It is updating only the first table, and saving
            columns and offsets to be used for updating the other
            (reference) tables.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221420960">
      </a>
      <a class="indexterm" name="idm46045221419456">
      </a>
      <code class="literal">
       updating reference tables
      </code>
     </p>
     <p>
      The server is executing the second part of a multiple-table
            update and updating the matched rows from the other tables.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221415920">
      </a>
      <a class="indexterm" name="idm46045221414432">
      </a>
      <code class="literal">
       User lock
      </code>
     </p>
     <p>
      The thread is going to request or is waiting for an advisory
            lock requested with a
      <a class="link" href="locking-functions.html#function_get-lock">
       <code class="literal">
        GET_LOCK()
       </code>
      </a>
      call. For
      <a class="link" href="show-profile.html" title="15.7.7.32 SHOW PROFILE Statement">
       <code class="literal">
        SHOW PROFILE
       </code>
      </a>
      , this state
            means the thread is requesting the lock (not waiting for
            it).
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221408400">
      </a>
      <a class="indexterm" name="idm46045221406912">
      </a>
      <code class="literal">
       User sleep
      </code>
     </p>
     <p>
      The thread has invoked a
      <a class="link" href="miscellaneous-functions.html#function_sleep">
       <code class="literal">
        SLEEP()
       </code>
      </a>
      call.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221402112">
      </a>
      <a class="indexterm" name="idm46045221400624">
      </a>
      <code class="literal">
       Waiting for commit lock
      </code>
     </p>
     <p>
      <a class="link" href="flush.html#flush-tables-with-read-lock">
       <code class="literal">
        FLUSH TABLES WITH READ LOCK
       </code>
      </a>
      is waiting for a commit lock.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221395984">
      </a>
      <a class="indexterm" name="idm46045221394480">
      </a>
      <code class="literal">
       waiting for handler commit
      </code>
     </p>
     <p>
      The thread is waiting for a transaction to commit versus
            other parts of query processing.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221390976">
      </a>
      <a class="indexterm" name="idm46045221389488">
      </a>
      <code class="literal">
       Waiting for tables
      </code>
     </p>
     <p>
      The thread got a notification that the underlying structure
            for a table has changed and it needs to reopen the table to
            get the new structure. However, to reopen the table, it must
            wait until all other threads have closed the table in
            question.
     </p>
     <p>
      This notification takes place if another thread has used
      <a class="link" href="flush.html#flush-tables">
       <code class="literal">
        FLUSH TABLES
       </code>
      </a>
      or one of the
            following statements on the table in question:
      <code class="literal">
       FLUSH TABLES
       <em class="replaceable">
        <code>
         tbl_name
        </code>
       </em>
      </code>
      ,
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER TABLE
       </code>
      </a>
      ,
      <a class="link" href="rename-table.html" title="15.1.36 RENAME TABLE Statement">
       <code class="literal">
        RENAME TABLE
       </code>
      </a>
      ,
      <a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
       <code class="literal">
        REPAIR TABLE
       </code>
      </a>
      ,
      <a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
       <code class="literal">
        ANALYZE TABLE
       </code>
      </a>
      , or
      <a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
       <code class="literal">
        OPTIMIZE TABLE
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221376864">
      </a>
      <a class="indexterm" name="idm46045221375376">
      </a>
      <code class="literal">
       Waiting for table flush
      </code>
     </p>
     <p>
      The thread is executing
      <a class="link" href="flush.html#flush-tables">
       <code class="literal">
        FLUSH
            TABLES
       </code>
      </a>
      and is waiting for all threads to close
            their tables, or the thread got a notification that the
            underlying structure for a table has changed and it needs to
            reopen the table to get the new structure. However, to
            reopen the table, it must wait until all other threads have
            closed the table in question.
     </p>
     <p>
      This notification takes place if another thread has used
      <a class="link" href="flush.html#flush-tables">
       <code class="literal">
        FLUSH TABLES
       </code>
      </a>
      or one of the
            following statements on the table in question:
      <code class="literal">
       FLUSH TABLES
       <em class="replaceable">
        <code>
         tbl_name
        </code>
       </em>
      </code>
      ,
      <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
       <code class="literal">
        ALTER TABLE
       </code>
      </a>
      ,
      <a class="link" href="rename-table.html" title="15.1.36 RENAME TABLE Statement">
       <code class="literal">
        RENAME TABLE
       </code>
      </a>
      ,
      <a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
       <code class="literal">
        REPAIR TABLE
       </code>
      </a>
      ,
      <a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
       <code class="literal">
        ANALYZE TABLE
       </code>
      </a>
      , or
      <a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
       <code class="literal">
        OPTIMIZE TABLE
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221361440">
      </a>
      <a class="indexterm" name="idm46045221359936">
      </a>
      <a class="indexterm" name="idm46045221358432">
      </a>
      <a class="indexterm" name="idm46045221356928">
      </a>
      <a class="indexterm" name="idm46045221355424">
      </a>
      <a class="indexterm" name="idm46045221353920">
      </a>
      <a class="indexterm" name="idm46045221352400">
      </a>
      <a class="indexterm" name="idm46045221350880">
      </a>
      <a class="indexterm" name="idm46045221349360">
      </a>
      <a class="indexterm" name="idm46045221347840">
      </a>
      <a class="indexterm" name="idm46045221346336">
      </a>
      <a class="indexterm" name="idm46045221344832">
      </a>
      <a class="indexterm" name="idm46045221343328">
      </a>
      <a class="indexterm" name="idm46045221341824">
      </a>
      <a class="indexterm" name="idm46045221340320">
      </a>
      <code class="literal">
       Waiting for
       <em class="replaceable">
        <code>
         lock_type
        </code>
       </em>
       lock
      </code>
     </p>
     <p>
      The server is waiting to acquire a
      <code class="literal">
       THR_LOCK
      </code>
      lock or a lock from the metadata
            locking subsystem, where
      <em class="replaceable">
       <code>
        lock_type
       </code>
      </em>
      indicates the type of
            lock.
     </p>
     <p>
      This state indicates a wait for a
      <code class="literal">
       THR_LOCK
      </code>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         <code class="literal">
          Waiting for table level lock
         </code>
        </p>
       </li>
      </ul>
     </div>
     <p>
      These states indicate a wait for a metadata lock:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         <code class="literal">
          Waiting for event metadata lock
         </code>
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          Waiting for global read lock
         </code>
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          Waiting for schema metadata lock
         </code>
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          Waiting for stored function metadata
                lock
         </code>
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          Waiting for stored procedure metadata
                lock
         </code>
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          Waiting for table metadata lock
         </code>
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          Waiting for trigger metadata lock
         </code>
        </p>
       </li>
      </ul>
     </div>
     <p>
      For information about table lock indicators, see
      <a class="xref" href="internal-locking.html" title="10.11.1 Internal Locking Methods">
       Section 10.11.1, “Internal Locking Methods”
      </a>
      . For information about
            metadata locking, see
      <a class="xref" href="metadata-locking.html" title="10.11.4 Metadata Locking">
       Section 10.11.4, “Metadata Locking”
      </a>
      . To
            see which locks are blocking lock requests, use the
            Performance Schema lock tables described at
      <a class="xref" href="performance-schema-lock-tables.html" title="29.12.13 Performance Schema Lock Tables">
       Section 29.12.13, “Performance Schema Lock Tables”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221318032">
      </a>
      <a class="indexterm" name="idm46045221316544">
      </a>
      <code class="literal">
       Waiting on cond
      </code>
     </p>
     <p>
      A generic state in which the thread is waiting for a
            condition to become true. No specific state information is
            available.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045221313024">
      </a>
      <a class="indexterm" name="idm46045221311536">
      </a>
      <code class="literal">
       Writing to net
      </code>
     </p>
     <p>
      The server is writing a packet to the network.
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
