<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="processlist-access">
      </a>
      10.14.1 Accessing the Process List
     </h3>
    </div>
   </div>
  </div>
  <p>
   The following discussion enumerates the sources of process
        information, the privileges required to see process information,
        and describes the content of process list entries.
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="processlist-access.html#processlist-sources" title="Sources of Process Information">
       Sources of Process Information
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="processlist-access.html#processlist-privileges" title="Privileges Required to Access the Process List">
       Privileges Required to Access the Process List
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="processlist-access.html#processlist-content" title="Content of Process List Entries">
       Content of Process List Entries
      </a>
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="processlist-sources">
       </a>
       Sources of Process Information
      </h4>
     </div>
    </div>
   </div>
   <p>
    Process information is available from these sources:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       The
       <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
        <code class="literal">
         SHOW PROCESSLIST
        </code>
       </a>
       statement:
       <a class="xref" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
        Section 15.7.7.31, “SHOW PROCESSLIST Statement”
       </a>
      </p>
     </li>
     <li class="listitem">
      <p>
       The
       <a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
        <span class="command">
         <strong>
          mysqladmin processlist
         </strong>
        </span>
       </a>
       command:
       <a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
        Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
       </a>
      </p>
     </li>
     <li class="listitem">
      <p>
       The
       <code class="literal">
        INFORMATION_SCHEMA
       </code>
       <a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
        <code class="literal">
         PROCESSLIST
        </code>
       </a>
       table:
       <a class="xref" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
        Section 28.3.23, “The INFORMATION_SCHEMA PROCESSLIST Table”
       </a>
      </p>
     </li>
     <li class="listitem">
      <p>
       The Performance Schema
       <a class="link" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
        <code class="literal">
         processlist
        </code>
       </a>
       table:
       <a class="xref" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
        Section 29.12.22.7, “The processlist Table”
       </a>
      </p>
     </li>
     <li class="listitem">
      <p>
       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 columns with
              names having a prefix of
       <code class="literal">
        PROCESSLIST_
       </code>
       :
       <a class="xref" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
        Section 29.12.22.8, “The threads Table”
       </a>
      </p>
     </li>
     <li class="listitem">
      <p>
       The
       <code class="literal">
        sys
       </code>
       schema
       <a class="link" href="sys-processlist.html" title="30.4.3.22 The processlist and x$processlist Views">
        <code class="literal">
         processlist
        </code>
       </a>
       and
       <a class="link" href="sys-session.html" title="30.4.3.33 The session and x$session Views">
        <code class="literal">
         session
        </code>
       </a>
       views:
       <a class="xref" href="sys-processlist.html" title="30.4.3.22 The processlist and x$processlist Views">
        Section 30.4.3.22, “The processlist and x$processlist Views”
       </a>
       , and
       <a class="xref" href="sys-session.html" title="30.4.3.33 The session and x$session Views">
        Section 30.4.3.33, “The session and x$session Views”
       </a>
      </p>
     </li>
    </ul>
   </div>
   <p>
    The
    <a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
     <code class="literal">
      threads
     </code>
    </a>
    table compares to
    <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
     <code class="literal">
      SHOW PROCESSLIST
     </code>
    </a>
    ,
    <code class="literal">
     INFORMATION_SCHEMA
    </code>
    <a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
     <code class="literal">
      PROCESSLIST
     </code>
    </a>
    , and
    <a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
     <span class="command">
      <strong>
       mysqladmin processlist
      </strong>
     </span>
    </a>
    as follows:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       Access to the
       <a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
        <code class="literal">
         threads
        </code>
       </a>
       table
              does not require a mutex and has minimal impact on server
              performance. The other sources have negative performance
              consequences because they require a mutex.
      </p>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        An alternative implementation for
        <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
         <code class="literal">
          SHOW PROCESSLIST
         </code>
        </a>
        is
                available based on the Performance Schema
        <a class="link" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
         <code class="literal">
          processlist
         </code>
        </a>
        table, which,
                like the
        <a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
         <code class="literal">
          threads
         </code>
        </a>
        table,
                does not require a mutex and has better performance
                characteristics. For details, see
        <a class="xref" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
         Section 29.12.22.7, “The processlist Table”
        </a>
        .
       </p>
      </div>
     </li>
     <li class="listitem">
      <p>
       The
       <a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
        <code class="literal">
         threads
        </code>
       </a>
       table displays
              background threads, which the other sources do not. It
              also provides additional information for each thread that
              the other sources do not, such as whether the thread is a
              foreground or background thread, and the location within
              the server associated with the thread. This means that the
       <a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
        <code class="literal">
         threads
        </code>
       </a>
       table can be used to
              monitor thread activity the other sources cannot.
      </p>
     </li>
     <li class="listitem">
      <p>
       You can enable or disable Performance Schema thread
              monitoring, as described in
       <a class="xref" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
        Section 29.12.22.8, “The threads Table”
       </a>
       .
      </p>
     </li>
    </ul>
   </div>
   <p>
    For these reasons, DBAs who perform server monitoring using
          one of the other thread information sources may wish to
          monitor using the
    <a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
     <code class="literal">
      threads
     </code>
    </a>
    table
          instead.
   </p>
   <p>
    The
    <code class="literal">
     sys
    </code>
    schema
    <a class="link" href="sys-processlist.html" title="30.4.3.22 The processlist and x$processlist Views">
     <code class="literal">
      processlist
     </code>
    </a>
    view presents
          information from 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 in a more
          accessible format. The
    <code class="literal">
     sys
    </code>
    schema
    <a class="link" href="sys-session.html" title="30.4.3.33 The session and x$session Views">
     <code class="literal">
      session
     </code>
    </a>
    view presents
          information about user sessions like the
    <code class="literal">
     sys
    </code>
    schema
    <a class="link" href="sys-processlist.html" title="30.4.3.22 The processlist and x$processlist Views">
     <code class="literal">
      processlist
     </code>
    </a>
    view, but with
          background processes filtered out.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="processlist-privileges">
       </a>
       Privileges Required to Access the Process List
      </h4>
     </div>
    </div>
   </div>
   <p>
    For most sources of process information, if you have the
    <a class="link" href="privileges-provided.html#priv_process">
     <code class="literal">
      PROCESS
     </code>
    </a>
    privilege, you can see
          all threads, even those belonging to other users. Otherwise
          (without the
    <a class="link" href="privileges-provided.html#priv_process">
     <code class="literal">
      PROCESS
     </code>
    </a>
    privilege), nonanonymous users have access to information
          about their own threads but not threads for other users, and
          anonymous users have no access to thread information.
   </p>
   <p>
    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 also provides thread information, but table access uses
          a different privilege model. See
    <a class="xref" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
     Section 29.12.22.8, “The threads Table”
    </a>
    .
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="processlist-content">
       </a>
       Content of Process List Entries
      </h4>
     </div>
    </div>
   </div>
   <p>
    Each process list entry contains several pieces of
          information. The following list describes them using the
          labels from
    <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
     <code class="literal">
      SHOW PROCESSLIST
     </code>
    </a>
    output. Other process information sources use similar labels.
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       <code class="literal">
        Id
       </code>
       is the connection identifier for the
              client associated with the thread.
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        User
       </code>
       and
       <code class="literal">
        Host
       </code>
       indicate the account associated with the thread.
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        db
       </code>
       is the default database for the
              thread, or
       <code class="literal">
        NULL
       </code>
       if none has been
              selected.
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        Command
       </code>
       and
       <code class="literal">
        State
       </code>
       indicate what the thread is doing.
      </p>
      <p>
       Most states correspond to very quick operations. If a
              thread stays in a given state for many seconds, there
              might be a problem that needs to be investigated.
      </p>
      <p>
       The following sections list the possible
       <code class="literal">
        Command
       </code>
       values, and
       <code class="literal">
        State
       </code>
       values grouped by category. The
              meaning for some of these values is self-evident. For
              others, additional description is provided.
      </p>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        Applications that examine process list information
                should be aware that the commands and states are subject
                to change.
       </p>
      </div>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        Time
       </code>
       indicates how long the thread has
              been in its current state. The thread's notion of the
              current time may be altered in some cases: The thread can
              change the time with
       <a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
        <code class="literal">
         SET
              TIMESTAMP =
         <em class="replaceable">
          <code>
           value
          </code>
         </em>
        </code>
       </a>
       .
              For a replica SQL thread, the value is the number of
              seconds between the timestamp of the last replicated event
              and the real time of the replica host. See
       <a class="xref" href="replication-threads.html" title="19.2.3 Replication Threads">
        Section 19.2.3, “Replication Threads”
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        Info
       </code>
       indicates the statement the thread
              is executing, or
       <code class="literal">
        NULL
       </code>
       if it is
              executing no statement. For
       <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
        <code class="literal">
         SHOW
              PROCESSLIST
        </code>
       </a>
       , this value contains only the first
              100 characters of the statement. To see complete
              statements, use
       <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
        <code class="literal">
         SHOW
              FULL PROCESSLIST
        </code>
       </a>
       (or query a different process
              information source).
      </p>
     </li>
    </ul>
   </div>
  </div>
 </div>
 <br/>
</div>
