mysql:show [full] processlist

来源:互联网 发布:高中生怎么找工作知乎 编辑:程序博客网 时间:2024/04/29 20:34

references:http://dev.mysql.com/doc/refman/5.5/en/thread-information.html

命令:show [full] processlist


Each process list entry contains several pieces of information:

  • Id is the connection identifier for the client associated with the thread.

  • User andHost indicate the account associated with the thread.

  • db is the default database for the thread, orNULL if none is selected.

  • Command andState indicate what the thread is doing.

    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.

  • Time 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 withSET TIMESTAMP = value. For a thread running on a slave that is processing events from the master, the thread time is set to the time found in the events and thus reflects current time on the master and not the slave.

  • Info contains the text of the statement being executed by the thread, orNULL if it is not executing one. By default, this value contains only the first 100 characters of the statement. To see the complete statements, useSHOW FULL PROCESSLIST.

Command values

  • Binlog Dump:This is a thread on a master server for sending binary log contents to a slave server.         
  • Change user :The thread is executing a change-user operation.
  • Close stmt:The thread is closing a prepared statement.
  • Connect:A replication slave is connected to its master.

  • Connect Out:A replication slave is connecting to its master.

  • Create DB :The thread is executing a create-database operation.

  • Daemon :This thread is internal to the server, not a thread that services a client connection.

  • Debug :The thread is generating debugging information.

  • Delayed insert :The thread is a delayed-insert handler.

  • Drop DB :The thread is executing a drop-database operation.

  • Error

  • Execute :The thread is executing a prepared statement.

  • Fetch :The thread is fetching the results from executing a prepared statement.

  • Field List :The thread is retrieving information for table columns.

  • Init DB :The thread is selecting a default database.

  • Kill :The thread is killing another thread.

  • Long Data :The thread is retrieving long data in the result of executing a prepared statement.

  • Ping :The thread is handling a server-ping request.

  • Prepare :The thread is preparing a prepared statement.

  • Processlist :The thread is producing information about server threads.

  • Query :The thread is executing a statement.

  • Quit :The thread is terminating.

  • Refresh :The thread is flushing table, logs, or caches, or resetting status variable or replication server information.

  • Register Slave :The thread is registering a slave server.

  • Reset stmt :The thread is resetting a prepared statement.

  • Set option :The thread is setting or resetting a client statement-execution option.

  • Shutdown :The thread is shutting down the server.

  • Sleep :The thread is waiting for the client to send a new statement to it.

  • Statistics: The thread is producing server-status information.

  • Table Dump: The thread is sending table contents to a slave server.

  • Time: Unused.

General State values

  • After create

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.

  • Analyzing

    The thread is calculating a MyISAM table key distributions (for example, forANALYZE TABLE).

  •  checking permissions

    The thread is checking whether the server has the required privileges to execute the statement.

  • Checking table

    The thread is performing a table check operation.

  • cleaning up

    The thread has processed one command and is preparing to free memory and reset certain state variables.

  •  closing tables

    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.

  •  converting HEAP to MyISAM

    The thread is converting an internal temporary table from a MEMORY table to an on-disk MyISAM table.

  • copy to tmp table

    The thread is processing an ALTER TABLE statement. This state occurs after the table with the new structure has been created but before rows are copied into it.

  •  Copying to group table

    If a statement has different ORDER BY and GROUP BY criteria, the rows are sorted by group and copied to a temporary table.

  • Copying to tmp table

    The server is copying to a temporary table in memory.

  •  Copying to tmp table on disk

    The server is copying to a temporary table on disk. The temporary result set has become too large (seeSection 8.4.4, “How MySQL Uses Internal Temporary Tables”). Consequently, the thread is changing the temporary table from in-memory to disk-based format to save memory.

  •  Creating index

    The thread is processing ALTER TABLE ... ENABLE KEYS for aMyISAM table.

  •  Creating sort index

    The thread is processing a SELECT that is resolved using an internal temporary table.

  • creating table

    The thread is creating a table. This includes creation of temporary tables.

  • Creating tmp table

    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 will beCopying to tmp table on disk.

  • deleting from main table

    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.

  • deleting from reference tables

    The server is executing the second part of a multiple-table delete and deleting the matched rows from the other tables.

  • discard_or_import_tablespace

    The thread is processing an ALTER TABLE ... DISCARD TABLESPACE orALTER TABLE ... IMPORT TABLESPACE statement.

  •  end

    This occurs at the end but before the cleanup of ALTER TABLE, CREATE VIEW, DELETE, INSERT, SELECT, or UPDATE statements.

  • executing

    The thread has begun executing a statement.

  • Execution of init_command

    The thread is executing statements in the value of the init_command system variable.

  • freeing items

    The thread has executed a command. Some freeing of items done during this state involves the query cache. This state is usually followed bycleaning up.

  • Flushing tables

    The thread is executing FLUSH TABLES and is waiting for all threads to close their tables.

  • FULLTEXT initialization

    The server is preparing to perform a natural-language full-text search.

  • init

    This occurs before the initialization of ALTER TABLE, DELETE, INSERT, SELECT, or UPDATE statements. Actions taken by the server in this state include flushing the binary log, theInnoDB log, and some query cache cleanup operations.

    For the end state, the following operations could be happening:

    • Removing query cache entries after data in a table is changed

    • Writing an event to the binary log

    • Freeing memory buffers, including for blobs

  •  Killed

    Someone has sent a KILL 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.

  • Locked

    The query is locked by another query.

    As of MySQL 5.5.3, this state was removed because it was equivalent to the Table lock state and no longer appears in SHOW PROCESSLIST output.

  • logging slow query

    The thread is writing a statement to the slow-query log.

  • NULL

    This state is used for the SHOW PROCESSLIST state.

  •  login

    The initial state for a connection thread until the client has been authenticated successfully.

  • manage keys

    The server is enabling or disabling a table index.

  •  Opening tables, Opening table

    The thread is trying to open a table. This is should be very fast procedure, unless something prevents opening. For example, anALTER TABLE or a LOCK TABLE statement can prevent opening a table until the statement is finished. It is also worth checking that yourtable_open_cache value is large enough.

  •  optimizing

    The server is performing initial optimizations for a query.

  • preparing

    This state occurs during query optimization.

  • Purging old relay logs

    The thread is removing unneeded relay log files.

  •  query end

    This state occurs after processing a query but before the freeing items state.

  • Reading from net

    The server is reading a packet from the network.

  •  Removing duplicates

    The query was using SELECT DISTINCT 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.

  • removing tmp table

    The thread is removing an internal temporary table after processing a SELECT statement. This state is not used if no temporary table was created.

  • rename

The thread is renaming a table.

  •  rename result table

    The thread is processing an ALTER TABLE statement, has created the new table, and is renaming it to replace the original table.

  •  Reopen tables

    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.

  • Repair by sorting

    The repair code is using a sort to create indexes.

  • Repair done

    The thread has completed a multi-threaded repair for a MyISAM table.

  • Repair with keycache

    The repair code is using creating keys one by one through the key cache. This is much slower thanRepair by sorting.

  • Rolling back

    The thread is rolling back a transaction.

  • Saving state

    For MyISAM table operations such as repair or analysis, the thread is saving the new table state to the.MYI file header. State includes information such as number of rows, theAUTO_INCREMENT counter, and key distributions.

  •  Searching rows for update

    The thread is doing a first phase to find all matching rows before updating them. This has to be done if theUPDATE is changing the index that is used to find the involved rows.

  • Sending data

    The thread is reading and processing rows for a SELECT statement, and sending data to the client. Because operations occurring during this state tend to perform large amounts of disk access (reads), it is often the longest-running state over the lifetime of a given query.

  •  setup

    The thread is beginning an ALTER TABLE operation.

  • Sorting for group

    The thread is doing a sort to satisfy a GROUP BY.

  • Sorting for order

    The thread is doing a sort to satisfy a ORDER BY.

  •  Sorting index

    The thread is sorting index pages for more efficient access during a MyISAM table optimization operation.

  • Sorting result

    For a SELECT statement, this is similar to Creating sort index, but for nontemporary tables.

  • statistics

    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.

  •  System lock

    The thread is going to request or is waiting for an internal or external system lock for the table. If this state is being caused by requests for external locks and you are not using multiplemysqld servers that are accessing the sameMyISAM tables, you can disable external system locks with the--skip-external-locking option. However, external locking is disabled by default, so it is likely that this option will have no effect. ForSHOW PROFILE, this state means the thread is requesting the lock (not waiting for it).

  •  Table lock

    The next thread state after System lock. The thread has acquired an external lock and is going to request an internal table lock.

    This state was replaced in MySQL 5.5.6 with Waiting for table level lock.

  • update

    The thread is getting ready to start updating the table.

  • Updating

    The thread is searching for rows to update and is updating them.

  •  updating main table

    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.

  • updating reference tables

    The server is executing the second part of a multiple-table update and updating the matched rows from the other tables.

  • User lock

    The thread is going to request or is waiting for an advisory lock requested with aGET_LOCK() call. For SHOW PROFILE, this state means the thread is requesting the lock (not waiting for it).

  •  User sleep

    The thread has invoked a SLEEP() call.

  • Waiting for all running commits to finish

    A statement that causes an explicit or implicit commit is waiting for release of a read lock. This state was removed in MySQL 5.5.8;Waiting for commit lock is used instead.

  • Waiting for commit lock

    A statement that causes an explicit or implicit commit is waiting for release of a read lock orFLUSH TABLES WITH READ LOCK is waiting for a commit lock. This state was added in MySQL 5.5.8.

  • Waiting for global read lock

    FLUSH TABLES WITH READ LOCK is waiting for a global read lock or the globalread_only system variable is being set.

  • Waiting for release of readlock

    The thread is waiting for a global read lock obtained by another thread (with FLUSH TABLES WITH READ LOCK) to be released. This state was removed in MySQL 5.5.8;Waiting for global read lock or Waiting for commit lock are used instead.

  • Waiting for tables, Waiting for table,Waiting for table flush

    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.

    This notification takes place if another thread has used FLUSH TABLES or one of the following statements on the table in question:FLUSH TABLES tbl_name,ALTER TABLE, RENAME TABLE, REPAIR TABLE, ANALYZE TABLE, or OPTIMIZE TABLE.

    In MySQL 5.5.6, Waiting for table was replaced withWaiting for table flush.

  •  Waiting for lock_type lock

    The server is waiting to acquire a lock, where lock_type indicates the type of lock:

    • Waiting for event metadata lock (added in MySQL 5.5.8)

    • Waiting for global metadata lock (replaced by Waiting for global read lock in MySQL 5.5.8)

    • Waiting for global read lock (added in MySQL 5.5.8)

    • Waiting for schema metadata lock

    • Waiting for stored function metadata lock

    • Waiting for stored procedure metadata lock

    • Waiting for table level lock

    • Waiting for table metadata lock

    • Waiting for trigger metadata lock (added in MySQL 5.5.8)

  • Waiting on cond

    A generic state in which the thread is waiting for a condition to become true. No specific state information is available.

  •  Waiting to get readlock

    The thread has issued a FLUSH TABLES WITH READ LOCK statement to obtain a global read lock and is waiting to obtain the lock. This state was removed in MySQL 5.5.8;Waiting for global read lock is used instead.

  •  Writing to net

    The server is writing a packet to the network.

  • others:
    • Delayed-Insert Thread States:
    • Query Cache Thread States: http://dev.mysql.com/doc/refman/5.5/en/query-cache-thread-states.html
    • Replication Master Thread States :
    • Replication Slave I/O Thread States
    • Replication Slave SQL Thread States
    • Replication Slave Connection Thread States
    • MySQL Cluster Thread States
    • Event Scheduler Thread States




0 0
原创粉丝点击