• 2026ÔĶÁ
  • 2»Ø¸´

MySQLÕ¼ÓÃCPU¹ý¸ßÈçºÎÓÅ»¯?Ö´ÐÐ top ÃüÁî

Â¥²ãÖ±´ï
MySQLÕ¼ÓÃCPU¹ý¸ßÈçºÎÓÅ»¯ Z-}A "n  
p/LV^TQ  
Ò»´ÎÉú²úDB·þÎñÆ÷µÄ ³¬¸ººÉÔËÐÐÎÊÌâ½â¾ö£º uTO%O}D N  
1.²é¿´Éú²úDB·þÎñÆ÷topÁÐ±í£¬ )iC@n8f7o  
Ö´ÐÐ top ÃüÁî Z"Q9^;0%  
²é¿´Cpu(s) ²ÎÊýÒ»Ö±´¦ÓÚ 98% ״̬ £¬load average´ïµ½ÁË 5  (4ºË·þÎñÆ÷) M.qv'zV`xG  
%)d7iT~M  
¿É¼ûDBÒѾ­³¬¸ººÉÔËÐÐÁË b,jo94.G  
KT(v'KE 1  
2.ʹÓÃrootÓû§µÇ¼mysql 'F/uD 1;  
Ö´ÐÐ show full processlist  ²é¿´Âý²éѯ£¬·´¸´Ö´ÐУ¬·¢ÏÖÒ»Ö±ÓÐ3¸öselect ²éѯÓï¾ä´æÔÚ£¬ÎªÁË»º½âDB·þÎñÆ÷ѹÁ¦£¬Ö±½ÓʹÓÃkillÃüÁîɱµô LV$Ko_9eA  
kill  Âý²éѯµÄid  Ks^wX  
·þÎñÆ÷ѹÁ¦»º½â£¬»Ö¸´Õý³£¡£  )L":I  
ʹÓÃÕâÌõSQLÓï¾äÈ¥ÏîÄ¿ÖÐÕÒµ½¶ÔÓ¦¹¦ÄÜ£¬¾­²éÊÇûÓõŦÄÜ£¬Ö±½ÓÒþ²ØÕâ¸ö¹¦ÄÜ£¬ÎÊÌâ½â¾ö¡£ i&)([C0z$  
o1{3[=G  
8090+ ( U  
"8a ?K Q  
MysqlÕ¼ÓÃCPU¹ý¸ßÈçºÎÓÅ»¯£¿ -i91nMi]  
y G mFi  
MySQL´¦Ôڸ߸ºÔØ»·¾³Ï£¬´ÅÅÌIO¶Áд¹ý¶à£¬¿Ï¶¨»áÕ¼Óúܶà×ÊÔ´£¬±ØÈ»CP»áUÕ¼Óùý¸ß¡£ :7Uv)@iUk  
Õ¼ÓÃCPU¹ý¸ß£¬¿ÉÒÔ×öÈçÏ¿¼ÂÇ£º vwa*'C  
1.´ò¿ªÂý²éѯÈÕÖ¾£¬²éѯÊÇ·ñÊÇij¸öSQLÓï¾äÕ¼Óùý¶à×ÊÔ´£¬Èç¹ûÊǵĻ°£¬¿ÉÒÔ¶ÔSQLÓï¾ä½øÐÐÓÅ»¯£¬±ÈÈçÓÅ»¯ insert Óï¾ä¡¢ÓÅ»¯ group by Óï¾ä¡¢ÓÅ»¯ order by Óï¾ä¡¢ÓÅ»¯ join Óï¾äµÈµÈ£» >xF&>SDC  
2.¿¼ÂÇË÷ÒýÎÊÌ⣻ t -}IKrbv  
3.¶¨ÆÚ·ÖÎö±í£¬Ê¹ÓÃoptimize table£» OP=-fX|*Q  
4.ÓÅ»¯Êý¾Ý¿â¶ÔÏó£» =E(ed,gH8  
5.¿¼ÂÇÊÇ·ñÊÇËøÎÊÌ⣻ E1w8d4P,G  
6.µ÷ÕûһЩMySQL Server²ÎÊý£¬±ÈÈçkey_buffer_size¡¢table_cache¡¢innodb_buffer_pool_size¡¢innodb_log_file_sizeµÈµÈ£» ~oK0k_{~  
7.Èç¹ûÊý¾ÝÁ¿¹ý´ó£¬¿ÉÒÔ¿¼ÂÇʹÓÃMySQL¼¯Èº»òÕߴ¸ß¿ÉÓû·¾³¡£ ^;[_CF _  
P)Oe?z;G?  
mysql show processlist + show status + kill IdÃüÁîÏê½â X1[zkb  
O69TU[Vn  
1. SHOW PROCESSLIST %uiCC>cC  
ÏÔʾÄÄЩÏß³ÌÕýÔÚÔËÐС£ÄúÒ²¿ÉÒÔʹÓÃmysqladmin processlistÓï¾äµÃµ½´ËÐÅÏ¢¡£Èç¹ûÄúÓÐSUPERȨÏÞ£¬Äú¿ÉÒÔ¿´µ½ËùÓÐÏ̡߳£·ñÔò£¬ÄúÖ»ÄÜ¿´µ½Äú×Ô¼ºµÄỊ̈߳¨Ò²¾ÍÊÇ£¬ÓëÄúÕýÔÚʹÓõÄMySQL ÕË»§Ïà¹ØµÄỊ̈߳©¡£Çë²Î¼û13.5.5.3½Ú£¬¡°KILLÓï·¨¡±¡£Èç¹ûÄú²»Ê¹ÓÃFULL¹Ø¼ü´Ê£¬ÔòÖ»ÏÔʾÿ¸ö²éѯµÄÇ°100¸ö×Ö·û¡£ +^AAik<yl  
zYWVz3l  
±¾Óï¾ä±¨¸æTCP/IPÁ¬½ÓµÄÖ÷»úÃû³Æ£¨²ÉÓÃhost_name:client_port¸ñʽ£©£¬ÒÔ·½±ãµØÅж¨Äĸö¿Í»§¶ËÕýÔÚ×öʲô¡£ -H|!KnR  
(Gapv9R  
Èç¹ûÄúµÃµ½¡°too many connections¡±´íÎóÐÅÏ¢£¬²¢ÇÒÏëÒªÁ˽âÕýÔÚ·¢ÉúµÄÇé¿ö£¬±¾Óï¾äÊǷdz£ÓÐÓõġ£MySQL±£ÁôÒ»¸ö¶îÍâµÄÁ¬½Ó£¬ÈÃÓµÓÐSUPERȨÏÞµÄ ÕË»§Ê¹Óã¬ÒÔÈ·±£¹ÜÀíÔ±Äܹ»ËæʱÁ¬½ÓºÍ¼ì²éϵͳ£¨¼ÙÉèÄúûÓаѴËȨÏÞ¸øÓèËùÓеÄÓû§£©¡£ XgeUS;qtta  
&t!f dti  
Õâ¸öÃüÁîÖÐ×î¹Ø¼üµÄ¾ÍÊÇstateÁУ¬mysqlÁгöµÄ״̬Ö÷ÒªÓÐÒÔϼ¸ÖÖ£º C}L2'l,  
Es\J%*\u  
Checking table u{D]Kc?n  
¡¡ÕýÔÚ¼ì²éÊý¾Ý±í£¨ÕâÊÇ×Ô¶¯µÄ£©¡£ z?UEn#E2  
Closing tables VuK>lY &  
¡¡ÕýÔÚ½«±íÖÐÐ޸ĵÄÊý¾Ýˢе½´ÅÅÌÖУ¬Í¬Ê±ÕýÔڹرÕÒѾ­ÓÃÍêµÄ±í¡£ÕâÊÇÒ»¸öºÜ¿ìµÄ²Ù×÷£¬Èç¹û²»ÊÇÕâÑùµÄ»°£¬¾ÍÓ¦¸ÃÈ·ÈÏ´ÅÅÌ¿Õ¼äÊÇ·ñÒѾ­ÂúÁË»òÕß´ÅÅÌÊÇ·ñÕý´¦ÓÚÖظºÖС£ IEkbVIA(  
Connect Out } ,Dk6w$  
¡¡¸´ÖÆ´Ó·þÎñÆ÷ÕýÔÚÁ¬½ÓÖ÷·þÎñÆ÷¡£ N1x~-2(  
Copying to tmp table on disk E2`9H-6e  
¡¡ÓÉÓÚÁÙʱ½á¹û¼¯´óÓÚtmp_table_size£¬ÕýÔÚ½«ÁÙʱ±í´ÓÄÚ´æ´æ´¢×ªÎª´ÅÅÌ´æ´¢ÒԴ˽ÚÊ¡ÄÚ´æ¡£ D})12qB;u9  
Creating tmp table 2Ib 1D  
¡¡ÕýÔÚ´´½¨ÁÙʱ±íÒÔ´æ·Å²¿·Ö²éѯ½á¹û¡£ aJ1{9 5ea  
deleting from main table i;IhsKO0R  
¡¡·þÎñÆ÷ÕýÔÚÖ´Ðжà±íɾ³ýÖеĵÚÒ»²¿·Ö£¬¸Õɾ³ýµÚÒ»¸ö±í¡£ |X6R 2I  
deleting from reference tables [W3sveqj&  
¡¡·þÎñÆ÷ÕýÔÚÖ´Ðжà±íɾ³ýÖеĵڶþ²¿·Ö£¬ÕýÔÚɾ³ýÆäËû±íµÄ¼Ç¼¡£ A#i[Us|  
Flushing tables `ah"Q;d$  
¡¡ÕýÔÚÖ´ÐÐFLUSH TABLES£¬µÈ´ýÆäËûÏ̹߳رÕÊý¾Ý±í¡£ 5HY0 *\  
Killed D& &71X '  
¡¡·¢ËÍÁËÒ»¸ökillÇëÇó¸øijỊ̈߳¬ÄÇôÕâ¸öÏ߳̽«»á¼ì²ékill±ê־λ£¬Í¬Ê±»á·ÅÆúÏÂÒ»¸ökillÇëÇó¡£MySQL»áÔÚÿ´ÎµÄÖ÷Ñ­»·Öмì²é kill±ê־룬²»¹ýÓÐЩÇé¿öϸÃÏ߳̿ÉÄÜ»á¹ýһС¶Î²ÅÄÜËÀµô¡£Èç¹û¸ÃÏ̳̱߳»ÆäËûÏß³ÌËøסÁË£¬ÄÇôkillÇëÇó»áÔÚËøÊÍ·ÅʱÂíÉÏÉúЧ¡£ 'coY`B; 8  
Locked Wdj|RKw  
¡¡±»ÆäËû²éѯËøסÁË¡£ ^B7Ls{  
Sending data {*  w _*  
¡¡ÕýÔÚ´¦ÀíSELECT²éѯµÄ¼Ç¼£¬Í¬Ê±ÕýÔڰѽá¹û·¢Ë͸ø¿Í»§¶Ë¡£ 8 ~Pdr]5  
Sorting for group O]!o|w(  
¡¡ÕýÔÚΪGROUP BY×öÅÅÐò¡£ -q? ,  
¡¡Sorting for order .}(X19R  
¡¡ÕýÔÚΪORDER BY×öÅÅÐò¡£ EDF0q i  
Opening tables .CW,Td3f!  
¡¡Õâ¸ö¹ý³ÌÓ¦¸Ã»áºÜ¿ì£¬³ý·ÇÊܵ½ÆäËûÒòËصĸÉÈÅ¡£ÀýÈ磬ÔÚÖ´ALTER TABLE»òLOCK TABLEÓï¾äÐÐÍêÒÔÇ°£¬Êý¾Ý±íÎÞ·¨±»ÆäËûÏ̴߳ò¿ª¡£Õý³¢ÊÔ´ò¿ªÒ»¸ö±í¡£ @V^5_K  
Removing duplicates ;r.#|b  
¡¡ÕýÔÚÖ´ÐÐÒ»¸öSELECT DISTINCT·½Ê½µÄ²éѯ£¬µ«ÊÇMySQLÎÞ·¨ÔÚÇ°Ò»¸ö½×¶ÎÓÅ»¯µôÄÇЩÖظ´µÄ¼Ç¼¡£Òò´Ë£¬MySQLÐèÒªÔÙ´ÎÈ¥µôÖظ´µÄ¼Ç¼£¬È»ºóÔٰѽá¹û·¢Ë͸ø¿Í»§¶Ë¡£ ,TYFPulYcp  
Reopen table K@:t6  
¡¡»ñµÃÁ˶ÔÒ»¸ö±íµÄËø£¬µ«ÊDZØÐëÔÚ±í½á¹¹ÐÞ¸ÄÖ®ºó²ÅÄÜ»ñµÃÕâ¸öËø¡£ÒѾ­ÊÍ·ÅËø£¬¹Ø±ÕÊý¾Ý±í£¬Õý³¢ÊÔÖØдò¿ªÊý¾Ý±í¡£ u4 ~.[3E*  
Repair by sorting DH4IF i>  
¡¡ÐÞ¸´Ö¸ÁîÕýÔÚÅÅÐòÒÔ´´½¨Ë÷Òý¡£ j^h:*rw  
Repair with keycache <@0S]jy  
¡¡ÐÞ¸´Ö¸ÁîÕýÔÚÀûÓÃË÷Òý»º´æÒ»¸öÒ»¸öµØ´´½¨ÐÂË÷Òý¡£Ëü»á±ÈRepair by sortingÂýЩ¡£ 152LdZevF  
Searching rows for update {Wfwf  
¡¡ÕýÔÚ½²·ûºÏÌõ¼þµÄ¼Ç¼ÕÒ³öÀ´ÒÔ±¸¸üС£Ëü±ØÐëÔÚUPDATEÒªÐÞ¸ÄÏà¹ØµÄ¼Ç¼֮ǰ¾ÍÍê³ÉÁË¡£ @,LU!#y(  
Sleeping jc,Q g2  
¡¡ÕýÔڵȴý¿Í»§¶Ë·¢ËÍÐÂÇëÇó. /neY2D6  
System lock E[BM0.#bZ  
¡¡ÕýÔڵȴýÈ¡µÃÒ»¸öÍⲿµÄϵͳËø¡£Èç¹ûµ±Ç°Ã»ÓÐÔËÐжà¸ömysqld·þÎñÆ÷ͬʱÇëÇóͬһ¸ö±í£¬ÄÇô¿ÉÒÔͨ¹ýÔö¼Ó--skip-external-locking²ÎÊýÀ´½ûÖ¹ÍⲿϵͳËø¡£ O]@s` w  
Upgrading lock P5GV9SA  
¡¡INSERT DELAYEDÕýÔÚ³¢ÊÔÈ¡µÃÒ»¸öËø±íÒÔ²åÈëмǼ¡£ @![1W@J  
Updating `91Z]zGpU  
¡¡ÕýÔÚËÑË÷Æ¥ÅäµÄ¼Ç¼£¬²¢ÇÒÐÞ¸ÄËüÃÇ¡£ vTL/% SJ8  
User Lock GXRW"4eF5  
¡¡ÕýÔڵȴýGET_LOCK()¡£ bik lja  
Waiting for tables J5z\e@?.0\  
¡¡¸ÃÏ̵߳õ½Í¨Öª£¬Êý¾Ý±í½á¹¹ÒѾ­±»ÐÞ¸ÄÁË£¬ÐèÒªÖØдò¿ªÊý¾Ý±íÒÔÈ¡µÃеĽṹ¡£È»ºó£¬ÎªÁËÄܵÄÖØдò¿ªÊý¾Ý±í£¬±ØÐëµÈµ½ËùÓÐÆäËûÏ̹߳رÕÕâ¸ö ±í¡£ÒÔϼ¸ÖÖÇé¿öÏ»á²úÉúÕâ¸ö֪ͨ£ºFLUSH TABLES tbl_name, ALTER TABLE, RENAME TABLE, REPAIR TABLE, ANALYZE TABLE,»òOPTIMIZE TABLE¡£ 7 ;2>kgf~  
waiting for handler insert 1{1mL-I;  
¡¡INSERT DELAYEDÒѾ­´¦ÀíÍêÁËËùÓдý´¦ÀíµÄ²åÈë²Ù×÷£¬ÕýÔڵȴýеÄÇëÇó¡£ xmfZ5nVL  
¡¡´ó²¿·Ö״̬¶ÔÓ¦ºÜ¿ìµÄ²Ù×÷£¬Ö»ÒªÓÐÒ»¸öÏ̱߳£³Öͬһ¸ö״̬ºÃ¼¸ÃëÖÓ£¬ÄÇô¿ÉÄÜÊÇÓÐÎÊÌâ·¢ÉúÁË£¬ÐèÒª¼ì²éһϡ£ `P$X`;SwE  
¡¡»¹ÓÐÆäËûµÄ״̬ûÔÚÉÏÃæÖÐÁгöÀ´£¬²»¹ýËüÃǴ󲿷ÖÖ»ÊÇÔڲ鿴·þÎñÆ÷ÊÇ·ñÓдæÔÚ´íÎóÊDzÅÓõÃ×Å¡£ .z*}%,G  
Ag&K@%|*  
mysql ²é¿´µ±Ç°Á¬½ÓÊý J*AYZS-tSE  
%MEWw  
ÃüÁ show processlist; D z[ ,;  
Èç¹ûÊÇrootÕʺţ¬ÄãÄÜ¿´µ½ËùÓÐÓû§µÄµ±Ç°Á¬½Ó¡£Èç¹ûÊÇÆäËüÆÕͨÕʺţ¬Ö»ÄÜ¿´µ½×Ô¼ºÕ¼ÓõÄÁ¬½Ó¡£ R0G!5>1i  
show processlist;Ö»ÁгöÇ°100Ìõ£¬Èç¹ûÏëÈ«ÁгöÇëʹÓÃshow full processlist; "I@akM$x  
mysql> show processlist; xlh<}V tp  
Ö»¿´¸Ã×÷Õß °²ÒÝɳ·¢  ·¢±íÓÚ: 2017-02-25
2. show status > 6CV4 L  
|KCOfVh?|.  
Aborted_clients ÓÉÓÚ¿Í»§Ã»ÓÐÕýÈ·¹Ø±ÕÁ¬½ÓÒѾ­ËÀµô£¬ÒѾ­·ÅÆúµÄÁ¬½ÓÊýÁ¿¡£ `i!wq&1g7  
Aborted_connects ³¢ÊÔÒѾ­Ê§°ÜµÄMySQL·þÎñÆ÷µÄÁ¬½ÓµÄ´ÎÊý¡£ P1kB>" bR  
Connections ÊÔͼÁ¬½ÓMySQL·þÎñÆ÷µÄ´ÎÊý¡£ {kB `>VS  
Created_tmp_tables µ±Ö´ÐÐÓï¾äʱ£¬ÒѾ­±»´´ÔìÁ˵ÄÒþº¬ÁÙʱ±íµÄÊýÁ¿¡£ M7}Q=q\9  
Delayed_insert_threads ÕýÔÚʹÓõÄÑÓ³Ù²åÈë´¦ÀíÆ÷Ï̵߳ÄÊýÁ¿¡£ JyBp-ii  
Delayed_writes ÓÃINSERT DELAYEDдÈëµÄÐÐÊý¡£ l)8&Ip  
Delayed_errors ÓÃINSERT DELAYEDдÈëµÄ·¢ÉúijЩ´íÎó(¿ÉÄÜÖظ´¼üÖµ)µÄÐÐÊý¡£ "l~Ci7& !a  
Flush_commands Ö´ÐÐFLUSHÃüÁîµÄ´ÎÊý¡£ H ZJL/=;  
Handler_delete ÇëÇó´ÓÒ»ÕűíÖÐɾ³ýÐеĴÎÊý¡£ dz9Y}\2tf  
Handler_read_first ÇëÇó¶ÁÈë±íÖеÚÒ»ÐеĴÎÊý¡£ o=+Z.-q  
Handler_read_key ÇëÇóÊý×Ö»ùÓÚ¼ü¶ÁÐС£ =jAFgwP\  
Handler_read_next ÇëÇó¶ÁÈë»ùÓÚÒ»¸ö¼üµÄÒ»ÐеĴÎÊý¡£ Rs;15@t@  
Handler_read_rnd ÇëÇó¶ÁÈë»ùÓÚÒ»¸ö¹Ì¶¨Î»ÖõÄÒ»ÐеĴÎÊý¡£ !AHAS  
Handler_update ÇëÇó¸üбíÖÐÒ»ÐеĴÎÊý¡£ $n=lsDnhQ  
Handler_write ÇëÇóÏò±íÖвåÈëÒ»ÐеĴÎÊý¡£ Un=a fX?j  
Key_blocks_used ÓÃÓڹؼü×Ö»º´æµÄ¿éµÄÊýÁ¿¡£ 9(1rh9`=  
Key_read_requests ÇëÇó´Ó»º´æ¶ÁÈëÒ»¸ö¼üÖµµÄ´ÎÊý¡£ J\co1kO9/  
Key_reads ´Ó´ÅÅÌÎïÀí¶ÁÈëÒ»¸ö¼üÖµµÄ´ÎÊý¡£ -E>)j\{PX7  
Key_write_requests ÇëÇó½«Ò»¸ö¹Ø¼ü×Ö¿éдÈ뻺´æ´ÎÊý¡£ .J.vC1 4gi  
Key_writes ½«Ò»¸ö¼üÖµ¿éÎïÀíдÈë´ÅÅ̵ĴÎÊý¡£ Utl t<  
Max_used_connections ͬʱʹÓõÄÁ¬½ÓµÄ×î´óÊýÄ¿¡£ Buc_9Kzw<+  
Not_flushed_key_blocks ÔÚ¼ü»º´æÖÐÒѾ­¸Ä±äµ«ÊÇ»¹Ã»±»Çå¿Õµ½´ÅÅÌÉϵļü¿é¡£ D,;\F,p  
Not_flushed_delayed_rows ÔÚINSERT DELAY¶ÓÁÐÖеȴýдÈëµÄÐеÄÊýÁ¿¡£ 4SVW/Zl.?  
Open_tables ´ò¿ª±íµÄÊýÁ¿¡£ Cnh|D^{s  
Open_files ´ò¿ªÎļþµÄÊýÁ¿¡£ HCnf2td  
Open_streams ´ò¿ªÁ÷µÄÊýÁ¿(Ö÷ÒªÓÃÓÚÈÕÖ¾¼ÇÔØ£© mV\$q@sII  
Opened_tables ÒѾ­´ò¿ªµÄ±íµÄÊýÁ¿¡£ [/9(NUf  
Questions ·¢Íù·þÎñÆ÷µÄ²éѯµÄÊýÁ¿¡£ pO/%N94s  
Slow_queries Òª»¨³¬¹ýlong_query_timeʱ¼äµÄ²éѯÊýÁ¿¡£ bH9Le  
Threads_connected µ±Ç°´ò¿ªµÄÁ¬½ÓµÄÊýÁ¿¡£ Eu<r$6Q0}o  
Threads_running ²»ÔÚ˯ÃßµÄÏß³ÌÊýÁ¿¡£ ;)/@Xx  
Uptime ·þÎñÆ÷¹¤×÷Á˶àÉÙÃë¡£ K&`Awv  
ej[Su  
After create NB)t7/Us  
2<6j1D^jM  
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. o}D![/  
3'#%c>_  
Analyzing L(o#4YH}>J  
tbur$ 00  
The thread is calculating a MyISAM table key distributions (for example, for ANALYZE TABLE). ~ =.CTm]vf  
hPO>,j^  
checking permissions YKx 1NC  
d6b.zP  
The thread is checking whether the server has the required privileges to execute the statement. /bcY6b=:  
r*d Q5 _  
Checking table ]N}]d +^6  
^ KOzCLC  
The thread is performing a table check operation. D rS?=C@  
,)$Wm-  
cleaning up _Ex?Xk  
(,tHL  
The thread has processed one command and is preparing to free memory and reset certain state variables. Bz:0L1@,4a  
3+ asP&n  
closing tables ND,`QjmZ  
Czh8zB+r  
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. .0 X$rX=  
/Sj_y*x1e  
converting HEAP to MyISAM k~|ZO/X@l%  
gMay  
The thread is converting an internal temporary table from a MEMORY table to an on-disk MyISAM table. I~k=3,7<  
Hdna{@~  
copy to tmp table 6vWii)O.D  
!7Uu]m69n  
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. `axQd%:AC  
NYwGK|  
Copying to group table QpJ IDM/  
2;}xN!8  
If a statement has different ORDER BY and GROUP BY criteria, the rows are sorted by group and copied to a temporary table. 2D_6  
l3\9S#3-^  
Copying to tmp table K"I{\/x@  
s)Gb!-``  
The server is copying to a temporary table in memory. w4aiI2KFq  
~Ji>[#W K  
Copying to tmp table on disk L*IU0Jy>  
k=FcPF"  
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. iPz1eUj  
C~:b*X   
Creating index Px$'(eMj^3  
M$#+W?m&  
The thread is processing ALTER TABLE ... ENABLE KEYS for a MyISAM table. d{?)q  
-5o?#%  
Creating sort index 1RmBtx\<  
+7`u9j.  
The thread is processing a SELECT that is resolved using an internal temporary table.  I8:"h  
3HXh6( e  
creating table 7eTA`@v5A  
69N1 mP  
The thread is creating a table. This includes creation of temporary tables. HE9. k.sS  
FW/6{tm  
Creating tmp table <<i=+ed8eP  
[''=><  
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. _.u~)Q`6  
3L%Y"4(mm  
deleting from main table ^XtHF|%0T  
Vx0MG{vG1  
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. <t% Ao,"  
#Lu4OSM+  
deleting from reference tables [R roHXdk+  
C6Um6 X9/i  
The server is executing the second part of a multiple-table delete and deleting the matched rows from the other tables. Q&\ZC?y4  
jFI]54,  
discard_or_import_tablespace !&W"f#_Z  
hg)!m\g  
The thread is processing an ALTER TABLE ... DISCARD TABLEspaCE or ALTER TABLE ... IMPORT TABLEspaCE statement. P#M<CG9  
1KfJl S+  
end 9 &?tQ"@x  
 uhPIV\  
This occurs at the end but before the cleanup of ALTER TABLE, CREATE VIEW, DELETE, INSERT, SELECT, or UPDATE statements. + xkMW%e<  
 F<XD^sO  
executing y"{UN M|R  
3@#,i<ge:  
The thread has begun executing a statement. (5CX*)R  
7ipY*DT8  
Execution of init_command '8iv?D5M  
s?z=q%-p  
The thread is executing statements in the value of the init_command system variable. Lt ZWs0l0  
wZ#~+ }T  
freeing items \p_8YC  
l"V8n BR`  
The thread has executed a command. This state is usually followed by cleaning up. WHh2fN'A5  
;U5x'}%0]  
Flushing tables ~vvQz"  
4 Q>jP3  
The thread is executing FLUSH TABLES and is waiting for all threads to close their tables. >H]|A<9u(  
5>^ W}0s  
FULLTEXT initialization B[k+#YYY  
0 Ci"tA3"  
The server is preparing to perform a natural-language full-text search. q2"'W|I  
;Bc<u[G  
init r z>zdj5}  
APOU&Wd  
This occurs before the initialization of ALTER TABLE, DELETE, INSERT, SELECT, or UPDATE statements. [OToz~=)  
F(kRAe;  
Killed M%dl?9pbq  
8f`b=r(a>  
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+cFp7nC  
9Z_OLai  
Locked u:>3j,Cs  
uL{~(?U$  
The query is locked by another query. IgnY* 2FT  
SbNUX  
logging slow query !/lY q;$R  
/xbF1@XtL  
The thread is writing a statement to the slow-query log. |~vQ0D  
ZN]c>w[ )I  
NULL L5P}%1 _  
h+d;`7Z>  
This state is used for the SHOW PROCESSLIST state. uNGxz*e  
j24  
login gBS#Z.  
6&Ir0K/  
The initial state for a connection thread until the client has been authenticated successfully. p5rRhu/|k3  
]|BSX-V.%i  
Opening tables, Opening table ]<?)(xz  
~,65/O  
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. n^)9QQ  
,DO mh<b  
preparing U: jf9L2  
Cb-E<W&2D  
This state occurs during query optimization. )t=u(:u]  
}f'1x%RS^  
Purging old relay logs ?C2;:ol  
4^^rOi0  
The thread is removing unneeded relay log files. Y6PA\7Y\  
E-iBA(H  
query end zL}hFmh  
EC&,0i4n:  
This state occurs after processing a query but before the freeing items state. X5<.%@Z  
0.0!5D[  
Reading from net BF!zfX?n  
Lc?O K"[m  
The server is reading a packet from the network. e_-/p`9  
&2igX?60  
Removing duplicates 7#3)&"j  
LL [>Uu?Y  
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. kc[["w&  
i`'^ zR(`i  
removing tmp table Uk6!Sb  
hspg-|R  
The thread is removing an internal temporary table after processing a SELECT statement. This state is not used if no temporary table was created. &N0|tn  
7`!( 8  
rename Y cpO;md  
QGy=JHb  
The thread is renaming a table. (=rv `1  
 Jx w<*  
rename result table I1O?)x~  
F\bI6gj  
The thread is processing an ALTER TABLE statement, has created the new table, and is renaming it to replace the original table. lJ#>Y5Qg  
d?Cl04  
Reopen tables uD5yw #`  
#jiqRhm  
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. )n@3@NV  
Ms)zEy>[Ql  
Repair by sorting ZQA C &:  
I xBO$ 2  
The repair code is using a sort to create indexes. \}NWR{=  
kH -b!  
Repair done hATy 3*4  
\;gt&*$-  
The thread has completed a multi-threaded repair for a MyISAM table. cLC7U?-  
L-{r*ccIW  
Repair with keycache |/s2AzDD  
\zL7 j 4  
The repair code is using creating keys one by one through the key cache. This is much slower than Repair by sorting. yt: V+qdv  
q.km>XRk~  
Rolling back _O9H. _E  
? 4Juw?  
The thread is rolling back a transaction. K/ m)f#  
z>;+'>XXgx  
Saving state Go7hDmu  
) '`AX\  
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. N4|q2Jvj6  
X`QW(rq  
Searching rows for update |hQ|'VCN  
810<1NP  
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. cGzYW~K  
_D,f 4.R  
Sending data yXo0z_ G  
q}v04Yy,o  
The thread is processing rows for a SELECT statement and also is sending data to the client. lc?mKW9  
7r[ %| :  
setup 'S4EKV]  
@))}\:  
The thread is beginning an ALTER TABLE operation. ^lc}FN  
m|2]lb  
Sorting for group /\a]S:V-j  
LLn{2,jfQ  
The thread is doing a sort to satisfy a GROUP BY. .4C[D{4  
n &\'Hm  
Sorting for order =Q8H]F  
&QOWW}  
The thread is doing a sort to satisfy a ORDER BY. f{^M.G@  
}L$Xb2^l  
Sorting index yw* mA1v  
4%!{?[$  
The thread is sorting index pages for more efficient access during a MyISAM table optimization operation. )}Rfa}MD  
v :+8U[x  
Sorting result q1TW?\pjb:  
txml*/zL  
For a SELECT statement, this is similar to Creating sort index, but for nontemporary tables. s !hI:$J.  
Wm$`ae   
statistics  z _O,Y  
aVQSN  
The server is calculating statistics to develop a query execution plan. Gin_E&%g  
H}sS4[z  
System lock B?;' lDz*  
)+n,5W  
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). ePq13!FC/  
80?6I%UB<  
Table lock 4{;8:ax&w  
Nm6Z|0S  
The next thread state after System lock. The thread has acquired an external lock and is going to request an internal table lock. + mfe*'AU  
'yPCZ`5H(  
Updating ?Oy'awf_  
bp]^EVx  
The thread is searching for rows to update and is updating them. bZNIxkc[Dh  
7FmbV/&c  
updating main table .FIt.XPzv  
f._l105.  
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. u0m5JD0/  
M{`/f@z(  
updating reference tables j/)"QiS*?  
slU  
The server is executing the second part of a multiple-table update and updating the matched rows from the other tables. ry.;u*F  
G 9DJa_]X  
User lock SArfczoB  
kTnOmA w  
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). r& vFikIz  
NF6X- ,c d  
Waiting for tables, Waiting for table kmryu=  
0y)}.'  
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. _eGT2,D5r  
z"tjDP  
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. >DHp*$y  
).LTts7c  
Waiting on cond wMGk!N  
a Sf/4\  
A generic state in which the thread is waiting for a condition to become true. No specific state information is available. gw"~RV0  
$[g_=Z  
Writing to net cB#nsu>  
syv$XeG=}  
The server is writing a packet to the network. ,|+Gls  
3. kill mysql Ö´ÐÐÏß³Ì petW M@  
(1) show processlist;
¿ìËٻظ´

ÏÞ100 ×Ö½Ú
°²ÒÝÍøÌáʾ:Èç¹ûÄúÌá½»¹ýÒ»´Îʧ°ÜÁË£¬¿ÉÒÔÓá±»Ö¸´Êý¾Ý¡±À´»Ö¸´Ìû×ÓÄÚÈÝ
 
ÈÏÖ¤Âë:
ÉÏÒ»¸ö ÏÂÒ»¸ö