免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2627 | 回复: 2

SHOW PROCESSLIST命令详解 [复制链接]

论坛徽章:
0
发表于 2011-12-23 03:59 |显示全部楼层
<div>
<p style="padding: 0px; margin: 0px 0px 0.7em; text-decoration: none;"><a href="http://dev.mysql.com/doc/refman/5.1/en/show-processlist.html" target="_blank">http://dev.mysql.com/doc/refman/5.1/en/show-processlist.html</a></p><p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; TEXT-DECORATION: none; PADDING-TOP: 0px"><span style="TEXT-DECORATION: none">SHOW PROCESSLIST</span>显示哪些线程正在运行。您也可以使用<strong><span>mysqladmin processlist</span></strong>语句得到此信息。如果您有<span>SUPER</span>权限,您可以看到所有线程。否则,您只能看到您自己的线程(也就是,与您正在使用的<span>MySQL</span>账户相关的线程)。如果您不使用<span>FULL</span>关键词,则只显示每个查询的前<span>100</span>个字符。</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">本语句报告<span>TCP/IP</span>连接的主机名称(采用<span><i><span>host_name</span></i><span>:<i>client_port</i></span></span>格式),以方便地判定哪个客户端正在做什么。</p>
<p style="padding: 0px; margin: 0px 0px 0.7em;">如果您得到“<span>too many connections</span>”错误信息,并且想要了解正在发生的情况,本语句是非常有用的。<span>MySQL</span>保留一个额外的连接,让拥有<span>SUPER</span>权限的 账户使用,以确保管理员能够随时连接和检查系统(假设您没有把此权限给予所有的用户)。</p><p><span style="font-family: courier new,courier;"><span style="font-size: small;"><strong>id&nbsp;</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #888888;">#ID标识,要kill一个语句的时候很有用</span><br><strong>use</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: small;"><span style="color: #888888;">#当前连接用户<br></span><strong>host</strong>&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: small;"><span style="color: #888888;">#显示这个连接从哪个ip的哪个端口上发出<br></span><strong>db</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: small;"><span style="color: #888888;">#数据库名<br></span><strong>command</strong>&nbsp; </span><span style="font-size: small;"><span style="color: #888888;">#连接状态,一般是休眠(sleep),查询(query),连接(connect)<br></span><strong>time</strong>&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: small;"><span style="color: #888888;">#连接持续时间,单位是秒<br></span><strong>state</strong>&nbsp;&nbsp;&nbsp; </span><span style="font-size: small;"><span style="color: #888888;">#显示当前sql语句的状态<br></span><strong>info</strong>&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(136, 136, 136);">#显示这个sql语句</span></span></span></p><p><span style="font-family: courier new,courier;"><span style="font-size: small;"><span style="color: #888888;"><br></span></span></span></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">这个命令中最关键的就是state列,mysql列出的状态主要有以下几种:</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Checking table<br></b> 正在检查数据表(这是自动的)。<br><b>Closing tables</b><br> 正在将表中修改的数据刷新到磁盘中,同时正在关闭已经用完的表。这是一个很快的操作,如果不是这样的话,就应该确认磁盘空间是否已经满了或者磁盘是否正处于重负中。<br><b>Connect Out</b><br> 复制从服务器正在连接主服务器。<br><b>Copying to tmp table on disk</b><br> 由于临时结果集大于tmp_table_size,正在将临时表从内存存储转为磁盘存储以此节省内存。<br><b>Creating tmp table</b><br> 正在创建临时表以存放部分查询结果。<br><b>deleting from main table</b><br> 服务器正在执行多表删除中的第一部分,刚删除第一个表。<br><b>deleting from reference tables<br></b> 服务器正在执行多表删除中的第二部分,正在删除其他表的记录。<br><b>Flushing tables<br></b> 正在执行FLUSH TABLES,等待其他线程关闭数据表。<br><b>Killed<br></b> 发送了一个kill请求给某线程,那么这个线程将会检查kill标志位,同时会放弃下一个kill请求。MySQL会在每次的主循环中检查kill标志位,不过有些情况下该线程可能会过一小段才能死掉。如果该线程程被其他线程锁住了,那么kill请求会在锁释放时马上生效。<br><b>Locked</b><br> 被其他查询锁住了。<br><b>Sending data</b><br> 正在处理SELECT查询的记录,同时正在把结果发送给客户端。<br><b>Sorting for group<br></b> 正在为GROUP BY做排序。<br> Sorting for order<br> 正在为ORDER BY做排序。<br><b>Opening tables</b><br> 这个过程应该会很快,除非受到其他因素的干扰。例如,在执ALTER TABLE或LOCK TABLE语句行完以前,数据表无法被其他线程打开。正尝试打开一个表。<br><b>Removing duplicates</b><br> 正在执行一个SELECT DISTINCT方式的查询,但是MySQL无法在前一个阶段优化掉那些重复的记录。因此,MySQL需要再次去掉重复的记录,然后再把结果发送给客户端。<br><b>Reopen table</b><br> 获得了对一个表的锁,但是必须在表结构修改之后才能获得这个锁。已经释放锁,关闭数据表,正尝试重新打开数据表。<br><b>Repair by sorting</b><br> 修复指令正在排序以创建索引。<br><b>Repair with keycache</b><br> 修复指令正在利用索引缓存一个一个地创建新索引。它会比Repair by sorting慢些。<br><b>Searching rows for update<br></b> 正在讲符合条件的记录找出来以备更新。它必须在UPDATE要修改相关的记录之前就完成了。<br><b>Sleeping</b><br> 正在等待客户端发送新请求.<br><b>System lock</b><br> 正在等待取得一个外部的系统锁。如果当前没有运行多个mysqld服务器同时请求同一个表,那么可以通过增加--skip-external-locking参数来禁止外部系统锁。<br><b>Upgrading lock</b><br> INSERT DELAYED正在尝试取得一个锁表以插入新记录。<br><b>Updating</b><br> 正在搜索匹配的记录,并且修改它们。<br><b>User Lock</b><br> 正在等待GET_LOCK()。<br><b>Waiting for tables<br></b> 该线程得到通知,数据表结构已经被修改了,需要重新打开数据表以取得新的结构。然后,为了能的重新打开数据表,必须等到所有其他线程关闭这个表。以下几种情况下会产生这个通知:FLUSH TABLES tbl_name, ALTER TABLE, RENAME TABLE, REPAIR TABLE, ANALYZE TABLE,或OPTIMIZE TABLE。<br><b>waiting for handler insert</b><br> INSERT DELAYED已经处理完了所有待处理的插入操作,正在等待新的请求。<br> 大部分状态对应很快的操作,只要有一个线程保持同一个状态好几秒钟,那么可能是有问题发生了,需要检查一下。<br> 还有其他的状态没在上面中列出来,不过它们大部分只是在查看服务器是否有存在错误是才用得着。</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>mysql 查看当前连接数</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><span style="FONT-FAMILY: 宋体" face="宋体">命令: show processlist;&nbsp;<br>如果是root帐号,你能看到所有用户的当前连接。如果是其它普通帐号,只能看到自己占用的连接。&nbsp;<br>show processlist;只列出前100条,如果想全列出请使用show full processlist;&nbsp;<br>mysql&gt; show processlist;</span></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><span style="FONT-FAMILY: 宋体" face="宋体">命令: show status;</span></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><span style="FONT-FAMILY: 宋体" face="宋体">Aborted_clients 由于客户没有正确关闭连接已经死掉,已经放弃的连接数量。&nbsp;<br>Aborted_connects 尝试已经失败的MySQL服务器的连接的次数。&nbsp;<br>Connections 试图连接MySQL服务器的次数。&nbsp;<br>Created_tmp_tables 当执行语句时,已经被创造了的隐含临时表的数量。&nbsp;<br>Delayed_insert_threads 正在使用的延迟插入处理器线程的数量。&nbsp;<br>Delayed_writes 用INSERT DELAYED写入的行数。&nbsp;<br>Delayed_errors 用INSERT DELAYED写入的发生某些错误(可能重复键值)的行数。&nbsp;<br>Flush_commands 执行FLUSH命令的次数。&nbsp;<br>Handler_delete 请求从一张表中删除行的次数。&nbsp;<br>Handler_read_first 请求读入表中第一行的次数。&nbsp;<br>Handler_read_key 请求数字基于键读行。&nbsp;<br>Handler_read_next 请求读入基于一个键的一行的次数。&nbsp;<br>Handler_read_rnd 请求读入基于一个固定位置的一行的次数。&nbsp;<br>Handler_update 请求更新表中一行的次数。&nbsp;<br>Handler_write 请求向表中插入一行的次数。&nbsp;<br>Key_blocks_used 用于关键字缓存的块的数量。&nbsp;<br>Key_read_requests 请求从缓存读入一个键值的次数。&nbsp;<br>Key_reads 从磁盘物理读入一个键值的次数。&nbsp;<br>Key_write_requests 请求将一个关键字块写入缓存次数。&nbsp;<br>Key_writes 将一个键值块物理写入磁盘的次数。&nbsp;<br>Max_used_connections 同时使用的连接的最大数目。&nbsp;<br>Not_flushed_key_blocks 在键缓存中已经改变但是还没被清空到磁盘上的键块。&nbsp;<br>Not_flushed_delayed_rows 在INSERT DELAY队列中等待写入的行的数量。&nbsp;<br>Open_tables 打开表的数量。&nbsp;<br>Open_files 打开文件的数量。&nbsp;<br>Open_streams 打开流的数量(主要用于日志记载)&nbsp;<br>Opened_tables 已经打开的表的数量。&nbsp;<br>Questions 发往服务器的查询的数量。&nbsp;<br>Slow_queries 要花超过long_query_time时间的查询数量。&nbsp;<br>Threads_connected 当前打开的连接的数量。&nbsp;<br>Threads_running 不在睡眠的线程数量。&nbsp;<br>Uptime 服务器工作了多少秒。</span></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>After create</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">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>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Analyzing</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is calculating a MyISAM table key distributions (for example, for ANALYZE TABLE).</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>checking permissions</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is checking whether the server has the required privileges to execute the statement.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Checking table</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is performing a table check operation.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>cleaning up</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread has processed one command and is preparing to free memory and reset certain state variables.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>closing tables</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is flushing the changed table data to disk and closing the used tables. This should be a fast operation. If not, you should verify that you do not have a full disk and that the disk is not in very heavy use.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>converting HEAP to MyISAM</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is converting an internal temporary table from a MEMORY table to an on-disk MyISAM table.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>copy to tmp table</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">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.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Copying to group table</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">If a statement has different ORDER BY and GROUP BY criteria, the rows are sorted by group and copied to a temporary table.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Copying to tmp table</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The server is copying to a temporary table in memory.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Copying to tmp table on disk</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The server is copying to a temporary table on disk. The temporary result set was larger than tmp_table_size and the thread is changing the temporary table from in-memory to disk-based format to save memory.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Creating index</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is processing ALTER TABLE ... ENABLE KEYS for a MyISAM table.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Creating sort index</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is processing a SELECT that is resolved using an internal temporary table.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>creating table</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is creating a table. This includes creation of temporary tables.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Creating tmp table</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">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 be Copying to tmp table on disk.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>deleting from main table</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">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>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>deleting from reference tables</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The server is executing the second part of a multiple-table delete and deleting the matched rows from the other tables.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>discard_or_import_tablespace</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is processing an ALTER TABLE ... DISCARD TABLESPACE or ALTER TABLE ... IMPORT TABLESPACE statement.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>end</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">This occurs at the end but before the cleanup of ALTER TABLE, CREATE VIEW, DELETE, INSERT, SELECT, or UPDATE statements.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>executing</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread has begun executing a statement.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Execution of init_command</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is executing statements in the value of the init_command system variable.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>freeing items</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread has executed a command. This state is usually followed by cleaning up.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Flushing tables</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is executing FLUSH TABLES and is waiting for all threads to close their tables.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>FULLTEXT initialization</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The server is preparing to perform a natural-language full-text search.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>init</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">This occurs before the initialization of ALTER TABLE, DELETE, INSERT, SELECT, or UPDATE statements.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Killed</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">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.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Locked</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The query is locked by another query.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>logging slow query</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is writing a statement to the slow-query log.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>NULL</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">This state is used for the SHOW PROCESSLIST state.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>login</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The initial state for a connection thread until the client has been authenticated successfully.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Opening tables, Opening table</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is trying to open a table. This is should be very fast procedure, unless something prevents opening. For example, an ALTER TABLE or a LOCK TABLE statement can prevent opening a table until the statement is finished.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>preparing</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">This state occurs during query optimization.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Purging old relay logs</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is removing unneeded relay log files.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>query end</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">This state occurs after processing a query but before the freeing items state.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Reading from net</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The server is reading a packet from the network.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Removing duplicates</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">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.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>removing tmp table</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is removing an internal temporary table after processing a SELECT statement. This state is not used if no temporary table was created.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>rename</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is renaming a table.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>rename result table</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is processing an ALTER TABLE statement, has created the new table, and is renaming it to replace the original table.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Reopen tables</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">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>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Repair by sorting</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The repair code is using a sort to create indexes.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Repair done</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread has completed a multi-threaded repair for a MyISAM table.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Repair with keycache</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The repair code is using creating keys one by one through the key cache. This is much slower than Repair by sorting.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Rolling back</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is rolling back a transaction.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Saving state</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">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, the AUTO_INCREMENT counter, and key distributions.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Searching rows for update</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is doing a first phase to find all matching rows before updating them. This has to be done if the UPDATE is changing the index that is used to find the involved rows.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Sending data</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is processing rows for a SELECT statement and also is sending data to the client.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>setup</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is beginning an ALTER TABLE operation.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Sorting for group</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is doing a sort to satisfy a GROUP BY.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Sorting for order</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is doing a sort to satisfy a ORDER BY.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Sorting index</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is sorting index pages for more efficient access during a MyISAM table optimization operation.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Sorting result</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">For a SELECT statement, this is similar to Creating sort index, but for nontemporary tables.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>statistics</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The server is calculating statistics to develop a query execution plan.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>System lock</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">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 multiple mysqld servers that are accessing the same 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. For SHOW PROFILE, this state means the thread is requesting the lock (not waiting for it).</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Table lock</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The next thread state after System lock. The thread has acquired an external lock and is going to request an internal table lock.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Updating</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is searching for rows to update and is updating them.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>updating main table</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">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>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>updating reference tables</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The server is executing the second part of a multiple-table update and updating the matched rows from the other tables.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>User lock</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The thread is going to request or is waiting for an advisory lock requested with a GET_LOCK() call. For SHOW PROFILE, this state means the thread is requesting the lock (not waiting for it).</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Waiting for tables, Waiting for table</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">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 style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">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.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Waiting on cond</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">A generic state in which the thread is waiting for a condition to become true. No specific state information is available.</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"><b>Writing to net</b></p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0.7em; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">The server is writing a packet to the network.</p>if ($ != jQuery) { $ = jQuery.noConflict(); } var isLogined = false; var cb_blogId = 80462; var cb_entryId = 1947165; var cb_blogApp = "JulyZhang"; var cb_blogUserGuid = "24c6b639-9402-e011-ac81-842b2b196315"; var cb_entryCreatedDate = '2011/1/28 17:29:00'; </div>

评分

参与人数 1可用积分 +30 收起 理由
fanglq04 + 30 很给力!

查看全部评分

论坛徽章:
105
狮子座
日期:2013-08-15 09:47:21处女座
日期:2013-10-09 10:04:27射手座
日期:2014-07-18 17:24:58处女座
日期:2014-07-24 09:29:49天秤座
日期:2014-07-24 09:30:06白羊座
日期:2014-07-24 15:26:28双子座
日期:2014-11-12 10:13:312015年辞旧岁徽章
日期:2015-03-03 16:54:152015年亚洲杯之澳大利亚
日期:2015-05-11 09:56:392015年亚洲杯之巴勒斯坦
日期:2015-05-11 09:59:282015年亚洲杯之韩国
日期:2015-05-11 10:16:082015亚冠之水原三星
日期:2015-05-13 09:50:46
发表于 2011-12-23 15:25 |显示全部楼层
帮顶!

论坛徽章:
4
CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52戌狗
日期:2013-12-27 15:08:11
发表于 2011-12-23 16:28 |显示全部楼层
好 加分30呀
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP