• 2023ÔĶÁ
  • 2»Ø¸´

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

Â¥²ãÖ±´ï
MySQLÕ¼ÓÃCPU¹ý¸ßÈçºÎÓÅ»¯ ,D2_Z]  
{WeXURp&nF  
Ò»´ÎÉú²úDB·þÎñÆ÷µÄ ³¬¸ººÉÔËÐÐÎÊÌâ½â¾ö£º E0^%|Mh]b  
1.²é¿´Éú²úDB·þÎñÆ÷topÁÐ±í£¬ A{x 7  
Ö´ÐÐ top ÃüÁî TTZxkK  
²é¿´Cpu(s) ²ÎÊýÒ»Ö±´¦ÓÚ 98% ״̬ £¬load average´ïµ½ÁË 5  (4ºË·þÎñÆ÷) #lshN,CPm  
!_-sTZ  
¿É¼ûDBÒѾ­³¬¸ººÉÔËÐÐÁË WCmNibj  
 ;[KriW  
2.ʹÓÃrootÓû§µÇ¼mysql p=_XMh`;  
Ö´ÐÐ show full processlist  ²é¿´Âý²éѯ£¬·´¸´Ö´ÐУ¬·¢ÏÖÒ»Ö±ÓÐ3¸öselect ²éѯÓï¾ä´æÔÚ£¬ÎªÁË»º½âDB·þÎñÆ÷ѹÁ¦£¬Ö±½ÓʹÓÃkillÃüÁîɱµô ^/C $L8#  
kill  Âý²éѯµÄid -e{)v'C)  
·þÎñÆ÷ѹÁ¦»º½â£¬»Ö¸´Õý³£¡£ HLSfoQ&)v  
ʹÓÃÕâÌõSQLÓï¾äÈ¥ÏîÄ¿ÖÐÕÒµ½¶ÔÓ¦¹¦ÄÜ£¬¾­²éÊÇûÓõŦÄÜ£¬Ö±½ÓÒþ²ØÕâ¸ö¹¦ÄÜ£¬ÎÊÌâ½â¾ö¡£ Z[k#AgC)  
UEEBWzH  
;v,9 v;T  
*U;4t/(  
MysqlÕ¼ÓÃCPU¹ý¸ßÈçºÎÓÅ»¯£¿  's>#8;X  
rb:<N%*t  
MySQL´¦Ôڸ߸ºÔØ»·¾³Ï£¬´ÅÅÌIO¶Áд¹ý¶à£¬¿Ï¶¨»áÕ¼Óúܶà×ÊÔ´£¬±ØÈ»CP»áUÕ¼Óùý¸ß¡£ Hs"% S  
Õ¼ÓÃCPU¹ý¸ß£¬¿ÉÒÔ×öÈçÏ¿¼ÂÇ£º %bIsrQ~B  
1.´ò¿ªÂý²éѯÈÕÖ¾£¬²éѯÊÇ·ñÊÇij¸öSQLÓï¾äÕ¼Óùý¶à×ÊÔ´£¬Èç¹ûÊǵĻ°£¬¿ÉÒÔ¶ÔSQLÓï¾ä½øÐÐÓÅ»¯£¬±ÈÈçÓÅ»¯ insert Óï¾ä¡¢ÓÅ»¯ group by Óï¾ä¡¢ÓÅ»¯ order by Óï¾ä¡¢ÓÅ»¯ join Óï¾äµÈµÈ£» 8^/+wa+G  
2.¿¼ÂÇË÷ÒýÎÊÌ⣻  r=fE8[,  
3.¶¨ÆÚ·ÖÎö±í£¬Ê¹ÓÃoptimize table£» G*i.a*9<)  
4.ÓÅ»¯Êý¾Ý¿â¶ÔÏó£» B/jrYT$;m  
5.¿¼ÂÇÊÇ·ñÊÇËøÎÊÌ⣻ %6AYCN?Ih  
6.µ÷ÕûһЩMySQL Server²ÎÊý£¬±ÈÈçkey_buffer_size¡¢table_cache¡¢innodb_buffer_pool_size¡¢innodb_log_file_sizeµÈµÈ£» MWM +hk1fs  
7.Èç¹ûÊý¾ÝÁ¿¹ý´ó£¬¿ÉÒÔ¿¼ÂÇʹÓÃMySQL¼¯Èº»òÕߴ¸ß¿ÉÓû·¾³¡£ XjX 2[*l  
P,(9cyS{  
mysql show processlist + show status + kill IdÃüÁîÏê½â Iq+2mQi*/k  
{`a(Tl8V  
1. SHOW PROCESSLIST > 84e`aGE  
ÏÔʾÄÄЩÏß³ÌÕýÔÚÔËÐС£ÄúÒ²¿ÉÒÔʹÓÃmysqladmin processlistÓï¾äµÃµ½´ËÐÅÏ¢¡£Èç¹ûÄúÓÐSUPERȨÏÞ£¬Äú¿ÉÒÔ¿´µ½ËùÓÐÏ̡߳£·ñÔò£¬ÄúÖ»ÄÜ¿´µ½Äú×Ô¼ºµÄỊ̈߳¨Ò²¾ÍÊÇ£¬ÓëÄúÕýÔÚʹÓõÄMySQL ÕË»§Ïà¹ØµÄỊ̈߳©¡£Çë²Î¼û13.5.5.3½Ú£¬¡°KILLÓï·¨¡±¡£Èç¹ûÄú²»Ê¹ÓÃFULL¹Ø¼ü´Ê£¬ÔòÖ»ÏÔʾÿ¸ö²éѯµÄÇ°100¸ö×Ö·û¡£ 6_WmCtvF  
G%;kGi`m  
±¾Óï¾ä±¨¸æTCP/IPÁ¬½ÓµÄÖ÷»úÃû³Æ£¨²ÉÓÃhost_name:client_port¸ñʽ£©£¬ÒÔ·½±ãµØÅж¨Äĸö¿Í»§¶ËÕýÔÚ×öʲô¡£ &I%IaNco  
$(3uOsy   
Èç¹ûÄúµÃµ½¡°too many connections¡±´íÎóÐÅÏ¢£¬²¢ÇÒÏëÒªÁ˽âÕýÔÚ·¢ÉúµÄÇé¿ö£¬±¾Óï¾äÊǷdz£ÓÐÓõġ£MySQL±£ÁôÒ»¸ö¶îÍâµÄÁ¬½Ó£¬ÈÃÓµÓÐSUPERȨÏÞµÄ ÕË»§Ê¹Óã¬ÒÔÈ·±£¹ÜÀíÔ±Äܹ»ËæʱÁ¬½ÓºÍ¼ì²éϵͳ£¨¼ÙÉèÄúûÓаѴËȨÏÞ¸øÓèËùÓеÄÓû§£©¡£ 7{4w 2)  
Ls1B \Aw_  
Õâ¸öÃüÁîÖÐ×î¹Ø¼üµÄ¾ÍÊÇstateÁУ¬mysqlÁгöµÄ״̬Ö÷ÒªÓÐÒÔϼ¸ÖÖ£º ?pqU3-knH  
 t!jYu<P  
Checking table Z|I-BPyn  
¡¡ÕýÔÚ¼ì²éÊý¾Ý±í£¨ÕâÊÇ×Ô¶¯µÄ£©¡£ vQgq]mA?  
Closing tables a.q;_5\5`  
¡¡ÕýÔÚ½«±íÖÐÐ޸ĵÄÊý¾Ýˢе½´ÅÅÌÖУ¬Í¬Ê±ÕýÔڹرÕÒѾ­ÓÃÍêµÄ±í¡£ÕâÊÇÒ»¸öºÜ¿ìµÄ²Ù×÷£¬Èç¹û²»ÊÇÕâÑùµÄ»°£¬¾ÍÓ¦¸ÃÈ·ÈÏ´ÅÅÌ¿Õ¼äÊÇ·ñÒѾ­ÂúÁË»òÕß´ÅÅÌÊÇ·ñÕý´¦ÓÚÖظºÖС£ O%&cE*eX  
Connect Out wt?o 7R2  
¡¡¸´ÖÆ´Ó·þÎñÆ÷ÕýÔÚÁ¬½ÓÖ÷·þÎñÆ÷¡£ ugLlI2 nJ  
Copying to tmp table on disk 4x=(Zw_X  
¡¡ÓÉÓÚÁÙʱ½á¹û¼¯´óÓÚtmp_table_size£¬ÕýÔÚ½«ÁÙʱ±í´ÓÄÚ´æ´æ´¢×ªÎª´ÅÅÌ´æ´¢ÒԴ˽ÚÊ¡ÄÚ´æ¡£ t7*#[x)a  
Creating tmp table WbcS: !0  
¡¡ÕýÔÚ´´½¨ÁÙʱ±íÒÔ´æ·Å²¿·Ö²éѯ½á¹û¡£ /pykW_`/-  
deleting from main table WD.U"YI8y  
¡¡·þÎñÆ÷ÕýÔÚÖ´Ðжà±íɾ³ýÖеĵÚÒ»²¿·Ö£¬¸Õɾ³ýµÚÒ»¸ö±í¡£ ^RNOcM|  
deleting from reference tables \Y5W!.(%w  
¡¡·þÎñÆ÷ÕýÔÚÖ´Ðжà±íɾ³ýÖеĵڶþ²¿·Ö£¬ÕýÔÚɾ³ýÆäËû±íµÄ¼Ç¼¡£ #fDs[  
Flushing tables '*T]fND4  
¡¡ÕýÔÚÖ´ÐÐFLUSH TABLES£¬µÈ´ýÆäËûÏ̹߳رÕÊý¾Ý±í¡£ ;rR/5d1!  
Killed $[ z y  
¡¡·¢ËÍÁËÒ»¸ökillÇëÇó¸øijỊ̈߳¬ÄÇôÕâ¸öÏ߳̽«»á¼ì²ékill±ê־λ£¬Í¬Ê±»á·ÅÆúÏÂÒ»¸ökillÇëÇó¡£MySQL»áÔÚÿ´ÎµÄÖ÷Ñ­»·Öмì²é kill±ê־룬²»¹ýÓÐЩÇé¿öϸÃÏ߳̿ÉÄÜ»á¹ýһС¶Î²ÅÄÜËÀµô¡£Èç¹û¸ÃÏ̳̱߳»ÆäËûÏß³ÌËøסÁË£¬ÄÇôkillÇëÇó»áÔÚËøÊÍ·ÅʱÂíÉÏÉúЧ¡£ 7o]HQ[xO  
Locked #b)e4vwCq  
¡¡±»ÆäËû²éѯËøסÁË¡£ +%0z`E\?M#  
Sending data A :e;k{J  
¡¡ÕýÔÚ´¦ÀíSELECT²éѯµÄ¼Ç¼£¬Í¬Ê±ÕýÔڰѽá¹û·¢Ë͸ø¿Í»§¶Ë¡£ CIC[1,  
Sorting for group anN#5jt  
¡¡ÕýÔÚΪGROUP BY×öÅÅÐò¡£ m$2<`C=  
¡¡Sorting for order L>9R4:g  
¡¡ÕýÔÚΪORDER BY×öÅÅÐò¡£ iCQ>@P]nE  
Opening tables DXR:1w[^  
¡¡Õâ¸ö¹ý³ÌÓ¦¸Ã»áºÜ¿ì£¬³ý·ÇÊܵ½ÆäËûÒòËصĸÉÈÅ¡£ÀýÈ磬ÔÚÖ´ALTER TABLE»òLOCK TABLEÓï¾äÐÐÍêÒÔÇ°£¬Êý¾Ý±íÎÞ·¨±»ÆäËûÏ̴߳ò¿ª¡£Õý³¢ÊÔ´ò¿ªÒ»¸ö±í¡£ 83Ou9E!W  
Removing duplicates Y3U9:VB  
¡¡ÕýÔÚÖ´ÐÐÒ»¸öSELECT DISTINCT·½Ê½µÄ²éѯ£¬µ«ÊÇMySQLÎÞ·¨ÔÚÇ°Ò»¸ö½×¶ÎÓÅ»¯µôÄÇЩÖظ´µÄ¼Ç¼¡£Òò´Ë£¬MySQLÐèÒªÔÙ´ÎÈ¥µôÖظ´µÄ¼Ç¼£¬È»ºóÔٰѽá¹û·¢Ë͸ø¿Í»§¶Ë¡£ S ZU \i*  
Reopen table *C|  
¡¡»ñµÃÁ˶ÔÒ»¸ö±íµÄËø£¬µ«ÊDZØÐëÔÚ±í½á¹¹ÐÞ¸ÄÖ®ºó²ÅÄÜ»ñµÃÕâ¸öËø¡£ÒѾ­ÊÍ·ÅËø£¬¹Ø±ÕÊý¾Ý±í£¬Õý³¢ÊÔÖØдò¿ªÊý¾Ý±í¡£ X[$++p .  
Repair by sorting cntco@  
¡¡ÐÞ¸´Ö¸ÁîÕýÔÚÅÅÐòÒÔ´´½¨Ë÷Òý¡£ r?$ ?;%|C  
Repair with keycache  >]D4Q<TY  
¡¡ÐÞ¸´Ö¸ÁîÕýÔÚÀûÓÃË÷Òý»º´æÒ»¸öÒ»¸öµØ´´½¨ÐÂË÷Òý¡£Ëü»á±ÈRepair by sortingÂýЩ¡£ 15\Ph[6g  
Searching rows for update V4w=/e _  
¡¡ÕýÔÚ½²·ûºÏÌõ¼þµÄ¼Ç¼ÕÒ³öÀ´ÒÔ±¸¸üС£Ëü±ØÐëÔÚUPDATEÒªÐÞ¸ÄÏà¹ØµÄ¼Ç¼֮ǰ¾ÍÍê³ÉÁË¡£ Zo-$z8  
Sleeping B^ 7eoW  
¡¡ÕýÔڵȴý¿Í»§¶Ë·¢ËÍÐÂÇëÇó. /u<nLj1  
System lock Dh| w^Q  
¡¡ÕýÔڵȴýÈ¡µÃÒ»¸öÍⲿµÄϵͳËø¡£Èç¹ûµ±Ç°Ã»ÓÐÔËÐжà¸ömysqld·þÎñÆ÷ͬʱÇëÇóͬһ¸ö±í£¬ÄÇô¿ÉÒÔͨ¹ýÔö¼Ó--skip-external-locking²ÎÊýÀ´½ûÖ¹ÍⲿϵͳËø¡£ ] ,etZ%z&  
Upgrading lock >H][.@LyR  
¡¡INSERT DELAYEDÕýÔÚ³¢ÊÔÈ¡µÃÒ»¸öËø±íÒÔ²åÈëмǼ¡£ h!@,8y[B  
Updating XKOUQc4!R  
¡¡ÕýÔÚËÑË÷Æ¥ÅäµÄ¼Ç¼£¬²¢ÇÒÐÞ¸ÄËüÃÇ¡£ w0m^ &,;#  
User Lock {^)70Vz>PE  
¡¡ÕýÔڵȴýGET_LOCK()¡£ d[gl]tj9  
Waiting for tables {Bvj"mL]j  
¡¡¸ÃÏ̵߳õ½Í¨Öª£¬Êý¾Ý±í½á¹¹ÒѾ­±»ÐÞ¸ÄÁË£¬ÐèÒªÖØдò¿ªÊý¾Ý±íÒÔÈ¡µÃеĽṹ¡£È»ºó£¬ÎªÁËÄܵÄÖØдò¿ªÊý¾Ý±í£¬±ØÐëµÈµ½ËùÓÐÆäËûÏ̹߳رÕÕâ¸ö ±í¡£ÒÔϼ¸ÖÖÇé¿öÏ»á²úÉúÕâ¸ö֪ͨ£ºFLUSH TABLES tbl_name, ALTER TABLE, RENAME TABLE, REPAIR TABLE, ANALYZE TABLE,»òOPTIMIZE TABLE¡£ gbBy/_b  
waiting for handler insert V)M1YZV{  
¡¡INSERT DELAYEDÒѾ­´¦ÀíÍêÁËËùÓдý´¦ÀíµÄ²åÈë²Ù×÷£¬ÕýÔڵȴýеÄÇëÇó¡£ %hS|68pN6  
¡¡´ó²¿·Ö״̬¶ÔÓ¦ºÜ¿ìµÄ²Ù×÷£¬Ö»ÒªÓÐÒ»¸öÏ̱߳£³Öͬһ¸ö״̬ºÃ¼¸ÃëÖÓ£¬ÄÇô¿ÉÄÜÊÇÓÐÎÊÌâ·¢ÉúÁË£¬ÐèÒª¼ì²éһϡ£ >T3H qYX5W  
¡¡»¹ÓÐÆäËûµÄ״̬ûÔÚÉÏÃæÖÐÁгöÀ´£¬²»¹ýËüÃǴ󲿷ÖÖ»ÊÇÔڲ鿴·þÎñÆ÷ÊÇ·ñÓдæÔÚ´íÎóÊDzÅÓõÃ×Å¡£ 5E\#%K[  
pcS+o  
mysql ²é¿´µ±Ç°Á¬½ÓÊý | $^;wP  
w?vVVA  
ÃüÁ show processlist; . v)mZp  
Èç¹ûÊÇrootÕʺţ¬ÄãÄÜ¿´µ½ËùÓÐÓû§µÄµ±Ç°Á¬½Ó¡£Èç¹ûÊÇÆäËüÆÕͨÕʺţ¬Ö»ÄÜ¿´µ½×Ô¼ºÕ¼ÓõÄÁ¬½Ó¡£ 8^^[XbH  
show processlist;Ö»ÁгöÇ°100Ìõ£¬Èç¹ûÏëÈ«ÁгöÇëʹÓÃshow full processlist; S0/usC[r  
mysql> show processlist; cR{>IH4^  
Ö»¿´¸Ã×÷Õß °²ÒÝɳ·¢  ·¢±íÓÚ: 2017-02-25
2. show status 4lr(,nPRD  
J2::'Hw*s  
Aborted_clients ÓÉÓÚ¿Í»§Ã»ÓÐÕýÈ·¹Ø±ÕÁ¬½ÓÒѾ­ËÀµô£¬ÒѾ­·ÅÆúµÄÁ¬½ÓÊýÁ¿¡£ d:#yEC  
Aborted_connects ³¢ÊÔÒѾ­Ê§°ÜµÄMySQL·þÎñÆ÷µÄÁ¬½ÓµÄ´ÎÊý¡£ H<VTa? n  
Connections ÊÔͼÁ¬½ÓMySQL·þÎñÆ÷µÄ´ÎÊý¡£ O~T@rX9f  
Created_tmp_tables µ±Ö´ÐÐÓï¾äʱ£¬ÒѾ­±»´´ÔìÁ˵ÄÒþº¬ÁÙʱ±íµÄÊýÁ¿¡£ k jg~n9#T  
Delayed_insert_threads ÕýÔÚʹÓõÄÑÓ³Ù²åÈë´¦ÀíÆ÷Ï̵߳ÄÊýÁ¿¡£ + fC=UAZ  
Delayed_writes ÓÃINSERT DELAYEDдÈëµÄÐÐÊý¡£ kW *f.!  
Delayed_errors ÓÃINSERT DELAYEDдÈëµÄ·¢ÉúijЩ´íÎó(¿ÉÄÜÖظ´¼üÖµ)µÄÐÐÊý¡£ v'U{/ ,x  
Flush_commands Ö´ÐÐFLUSHÃüÁîµÄ´ÎÊý¡£ :Pvzl1  
Handler_delete ÇëÇó´ÓÒ»ÕűíÖÐɾ³ýÐеĴÎÊý¡£ +b.g$CRr  
Handler_read_first ÇëÇó¶ÁÈë±íÖеÚÒ»ÐеĴÎÊý¡£ @aAW*D~-J  
Handler_read_key ÇëÇóÊý×Ö»ùÓÚ¼ü¶ÁÐС£ 4[;X{ !  
Handler_read_next ÇëÇó¶ÁÈë»ùÓÚÒ»¸ö¼üµÄÒ»ÐеĴÎÊý¡£ V,mw[Hw  
Handler_read_rnd ÇëÇó¶ÁÈë»ùÓÚÒ»¸ö¹Ì¶¨Î»ÖõÄÒ»ÐеĴÎÊý¡£ HW=C),*]cR  
Handler_update ÇëÇó¸üбíÖÐÒ»ÐеĴÎÊý¡£ SLkhCR  
Handler_write ÇëÇóÏò±íÖвåÈëÒ»ÐеĴÎÊý¡£ [Grxw[(_:  
Key_blocks_used ÓÃÓڹؼü×Ö»º´æµÄ¿éµÄÊýÁ¿¡£ !D@ZYK;  
Key_read_requests ÇëÇó´Ó»º´æ¶ÁÈëÒ»¸ö¼üÖµµÄ´ÎÊý¡£ spdvZU=}  
Key_reads ´Ó´ÅÅÌÎïÀí¶ÁÈëÒ»¸ö¼üÖµµÄ´ÎÊý¡£ d/ARm-D  
Key_write_requests ÇëÇó½«Ò»¸ö¹Ø¼ü×Ö¿éдÈ뻺´æ´ÎÊý¡£ e7m*rh%5>  
Key_writes ½«Ò»¸ö¼üÖµ¿éÎïÀíдÈë´ÅÅ̵ĴÎÊý¡£ nSW=LjrO~<  
Max_used_connections ͬʱʹÓõÄÁ¬½ÓµÄ×î´óÊýÄ¿¡£ |2RC#]/-Y  
Not_flushed_key_blocks ÔÚ¼ü»º´æÖÐÒѾ­¸Ä±äµ«ÊÇ»¹Ã»±»Çå¿Õµ½´ÅÅÌÉϵļü¿é¡£ t; 4]cg:_  
Not_flushed_delayed_rows ÔÚINSERT DELAY¶ÓÁÐÖеȴýдÈëµÄÐеÄÊýÁ¿¡£ *pSQU=dmS  
Open_tables ´ò¿ª±íµÄÊýÁ¿¡£ [U5\bX@$  
Open_files ´ò¿ªÎļþµÄÊýÁ¿¡£ Oy%''+g   
Open_streams ´ò¿ªÁ÷µÄÊýÁ¿(Ö÷ÒªÓÃÓÚÈÕÖ¾¼ÇÔØ£© !ePr5On  
Opened_tables ÒѾ­´ò¿ªµÄ±íµÄÊýÁ¿¡£ S 5/R_5  
Questions ·¢Íù·þÎñÆ÷µÄ²éѯµÄÊýÁ¿¡£ }|g\ 8jq  
Slow_queries Òª»¨³¬¹ýlong_query_timeʱ¼äµÄ²éѯÊýÁ¿¡£ 0\[Chja  
Threads_connected µ±Ç°´ò¿ªµÄÁ¬½ÓµÄÊýÁ¿¡£ OR%'K2C6S  
Threads_running ²»ÔÚ˯ÃßµÄÏß³ÌÊýÁ¿¡£ }s(N6a&(  
Uptime ·þÎñÆ÷¹¤×÷Á˶àÉÙÃë¡£ ~$)2s7 O  
H@q?v+2  
After create @JD;k>  
N"]q='t  
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. a0D%k:k5  
FFu9&8Y  
Analyzing nEJY5Bz$  
BW 4%l  
The thread is calculating a MyISAM table key distributions (for example, for ANALYZE TABLE). y#U+c*LB  
9%B\/&f  
checking permissions xlA$:M&  
dwDcR,z?a  
The thread is checking whether the server has the required privileges to execute the statement. _V7r1fY:  
*7ZN]/VRT  
Checking table vb<oi&X  
7?GIS '  
The thread is performing a table check operation. .k%[4:Fe  
M$/|)U'W  
cleaning up L"o>wYx  
>[*8I\*@n  
The thread has processed one command and is preparing to free memory and reset certain state variables. 57umx`m  
CGY]r.O*  
closing tables +l9!Fl{MK\  
7UVzp v  
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. >z%&xgOa  
>8WP0 Qx/  
converting HEAP to MyISAM  @~!wDDS  
vms|x wb  
The thread is converting an internal temporary table from a MEMORY table to an on-disk MyISAM table. 1IC~e^"  
6p?,(  
copy to tmp table iOU6V  
++6`sMJ  
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. i;/5Y'KZ  
Fl kcU `j  
Copying to group table 'gC_)rK*  
/178A;J y  
If a statement has different ORDER BY and GROUP BY criteria, the rows are sorted by group and copied to a temporary table. }001K  
(.D~0a JU  
Copying to tmp table }+.}J  
#$18*?tLv|  
The server is copying to a temporary table in memory. ,w {e  
A#.edVj.g4  
Copying to tmp table on disk a1C{(f)  
,}3 'I [  
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. (;T^8mI2  
F*IzQ(#HW  
Creating index #|L8tuWW  
RRmz"j>  
The thread is processing ALTER TABLE ... ENABLE KEYS for a MyISAM table. 1oR7iD^  
S\:P-&dC  
Creating sort index ]{3)^axW;  
tXNm$Cq.|  
The thread is processing a SELECT that is resolved using an internal temporary table. s'!Cp=xQF"  
o_XflzC  
creating table arIf'CG6  
J%u=Ucdh  
The thread is creating a table. This includes creation of temporary tables. 2;k*@k-t  
MI/MhkS ?  
Creating tmp table IHB} `e|  
Bo)3!wO8  
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. (/=f6^}  
fT;s-v[`k  
deleting from main table "sS}N%!  
6/5YjO|a  
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. ?^7t'`zk  
I@T8Iv=  
deleting from reference tables bp* ^z,w  
[A~y%bI"  
The server is executing the second part of a multiple-table delete and deleting the matched rows from the other tables. DVG(V w  
M\o9I  
discard_or_import_tablespace )B T   
`nUXDmdwzO  
The thread is processing an ALTER TABLE ... DISCARD TABLEspaCE or ALTER TABLE ... IMPORT TABLEspaCE statement. @:j}Jmg  
|9uOUE  
end eX?OYDDC0j  
IshKH -  
This occurs at the end but before the cleanup of ALTER TABLE, CREATE VIEW, DELETE, INSERT, SELECT, or UPDATE statements. 4;w;'3zq  
h:W;^\J:-  
executing p ?*Q- f  
zpzK>DH(  
The thread has begun executing a statement. $ZUdT  
,KF 'TsFf  
Execution of init_command -c_74c50  
US+Q~GTA  
The thread is executing statements in the value of the init_command system variable. Qk0R a_  
-j+UMlkB  
freeing items b[sx_b  
z#8~iF1  
The thread has executed a command. This state is usually followed by cleaning up. ED2a}Tt>Z  
hP=WFD&  
Flushing tables cCSs  
~De"?  
The thread is executing FLUSH TABLES and is waiting for all threads to close their tables. N/[p <  
8|b3j^u  
FULLTEXT initialization 4ae`pAu  
ucuSe!IcX  
The server is preparing to perform a natural-language full-text search. heltgRt  
)}''L{k-  
init ~{*7"o/  
~ {?_p@&n  
This occurs before the initialization of ALTER TABLE, DELETE, INSERT, SELECT, or UPDATE statements. 4]rnY~  
#ml S}~n  
Killed anuL1f XO  
k=2Lo  
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. V @rI`~$  
VJ84?b{c W  
Locked ]~844J p  
1ofKt=|=  
The query is locked by another query. K*\' .~[6  
?8HHA: GP  
logging slow query |HU@ >  
xE1 eT,  
The thread is writing a statement to the slow-query log. w|3z;-#Q;  
:Y-{Kn6`_  
NULL BW-`t-,E;  
\ Fl+\?~D  
This state is used for the SHOW PROCESSLIST state. u,F nAh?"  
g$n7CXoT  
login Xsa2(-  
Yj%U >),8  
The initial state for a connection thread until the client has been authenticated successfully. Y_}mYvJW  
yphS'AG  
Opening tables, Opening table X7[^s $VK  
5>VY LI  
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. ()tp>  
cQG +$0(  
preparing 0$_oT;{8  
Q=BZ N]g2  
This state occurs during query optimization. U ?'vXa  
"nm FzN  
Purging old relay logs 6)z?f4,  
6Z#\CixG  
The thread is removing unneeded relay log files. MWI4Y@1bS  
VmCW6 G#M  
query end CL)lq)1(  
uqM yoIc  
This state occurs after processing a query but before the freeing items state. Bt1p'g(V|  
!E,A7s  
Reading from net y'(Ne=y  
T(AVlI6  
The server is reading a packet from the network. )>b.;  
# S}Z8  
Removing duplicates N-jTc?mT~&  
=1O<E  
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. k=4N(i/s  
_ ):d`O e  
removing tmp table ~zil/P8  
?q(\=;Y  
The thread is removing an internal temporary table after processing a SELECT statement. This state is not used if no temporary table was created. \%/#x V  
.Q@S #d  
rename !>BZ6gn5  
?+g`HTY u  
The thread is renaming a table. K+Z+wA?  
o@#Y8M  
rename result table K TsgJ\W  
"z0zpHXek  
The thread is processing an ALTER TABLE statement, has created the new table, and is renaming it to replace the original table. c9kzOQ2n  
T[,/5J  
Reopen tables {fha`i  
f6_];]yP  
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. f;&]:2.j  
4Ue_Y 'LmM  
Repair by sorting uKz,SqX  
JCPUM *g8  
The repair code is using a sort to create indexes. lqowG!3H  
Y 2Q=rj  
Repair done  QV h4  
ly4s"4v  
The thread has completed a multi-threaded repair for a MyISAM table. #Hvq/7a2R  
 ],ZzI  
Repair with keycache -*~CV:2iq-  
/wxE1][.  
The repair code is using creating keys one by one through the key cache. This is much slower than Repair by sorting. PN$X N<  
zP:cE  
Rolling back +&X%<S W  
6oinidB[l  
The thread is rolling back a transaction. -UZ@G~K  
g|Y] wd  
Saving state WKr X,GF  
FZ|CqD"#  
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. QN>7~=`  
-ZW3  
Searching rows for update T"T;`y@(  
/<&h@$NHH4  
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. joXfmHB}  
J9%@VZut  
Sending data |!H?+Jj:  
4KI [D{  
The thread is processing rows for a SELECT statement and also is sending data to the client. aV`&L,Q)7E  
L{ho*^b  
setup V (rr"K+  
-$<O\5cAQ  
The thread is beginning an ALTER TABLE operation. Y-~~,Yl~  
;`v% sx#  
Sorting for group cPn+<M#  
( 0Naf  
The thread is doing a sort to satisfy a GROUP BY. -Dzsa  
=y%rG :!  
Sorting for order zzZg$9PT[  
XTqm]  
The thread is doing a sort to satisfy a ORDER BY. 49 }{R/:  
:a3LS|W  
Sorting index ~fzuwz  
BH@b1}  
The thread is sorting index pages for more efficient access during a MyISAM table optimization operation. tkuc/Z/@  
|$hgT K[L  
Sorting result 8*!|8 BPj^  
QLb MPS  
For a SELECT statement, this is similar to Creating sort index, but for nontemporary tables. qeaA&(|5  
J\W-dI  
statistics cfoYnM  
X<MpN5%|Wo  
The server is calculating statistics to develop a query execution plan. 73DlRt *  
_|n=cC4Qu  
System lock VEh]p5D  
JmWR{du  
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). 0B3 Q Vbp'  
F +j O*F2h  
Table lock 0K3Hf^>m  
!Q[}s #g  
The next thread state after System lock. The thread has acquired an external lock and is going to request an internal table lock. -h\@RC  
ag]*DsBt  
Updating J'7 y   
T8q[7Zn  
The thread is searching for rows to update and is updating them. @f=RL)$|  
>)%#V<{<  
updating main table M'|)dM|  
FH -p!4+]  
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. q6)p*}-  
nL\ZId  
updating reference tables rIp'vy S\p  
`Of[{.Q  
The server is executing the second part of a multiple-table update and updating the matched rows from the other tables. R8{e&n PE  
_s@bz|yqw  
User lock \vs%U}IrO  
wjg}[R@!  
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). 6o9sR)c ?  
/9TL&_A-T  
Waiting for tables, Waiting for table -Cml0}.O   
I4CHfs"ar  
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. ax;{MfsK  
)MMhlcNC  
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. a]{uZGn@i  
 Q;Q  
Waiting on cond `6n!$Cxo  
% Mw'e/?  
A generic state in which the thread is waiting for a condition to become true. No specific state information is available. T^+1rG  
tu7+LwF7  
Writing to net $8EV, 9^U  
^#}dPGm  
The server is writing a packet to the network. 1mY+0  
3. kill mysql Ö´ÐÐÏß³Ì 8H&_,;  
(1) show processlist;
¿ìËٻظ´

ÏÞ100 ×Ö½Ú
°²ÒÝÍøÌáʾ:Èç¹ûÄúÔÚд³¤ÆªÌû×ÓÓÖ²»ÂíÉÏ·¢±í£¬½¨Òé´æΪ²Ý¸å
 
ÈÏÖ¤Âë:
ÉÏÒ»¸ö ÏÂÒ»¸ö