mysql show processlist state
這個命令中最關鍵的就是state列,mysql列出的狀態主要有以下幾種:
Checking table
正在檢查資料表(這是自動的)。
Closing tables
正在將表中修改的資料重新整理到磁碟中,同時正在關閉已經用完的表。這是一個很快的操作,如果不是這樣的話,就應該確認磁碟空間是否已經滿了或者磁碟是否正處於重負中。
Connect Out
複製從伺服器正在連線主伺服器。
Copying to tmp table on disk
由於臨時結果集大於tmp_table_size,正在將臨時表從記憶體儲存轉為磁碟儲存以此節省記憶體。
Creating tmp table
正在建立臨時表以存放部分查詢結果。
deleting from main table
伺服器正在執行多表刪除中的第一部分,剛刪除第一個表。
deleting from reference tables
伺服器正在執行多表刪除中的第二部分,正在刪除其他表的記錄。
Flushing tables
正在執行FLUSH TABLES,等待其他執行緒關閉資料表。
Killed
傳送了一個kill請求給某執行緒,那麼這個執行緒將會檢查kill標誌位,同時會放棄下一個kill請求。MySQL會在每次的主迴圈中檢查kill標誌位,不過有些情況下該執行緒可能會過一小段才能死掉。如果該執行緒程被其他執行緒鎖住了,那麼kill請求會在鎖釋放時馬上生效。
Locked
被其他查詢鎖住了。
Sending data
正在處理SELECT查詢的記錄,同時正在把結果傳送給客戶端。
Sorting for group
正在為GROUP BY做排序。
Sorting for order
正在為ORDER BY做排序。
Opening tables
這個過程應該會很快,除非受到其他因素的干擾。例如,在執ALTER TABLE或LOCK TABLE語句行完以前,資料表無法被其他執行緒開啟。正嘗試開啟一個表。
Removing duplicates
正在執行一個SELECT DISTINCT方式的查詢,但是MySQL無法在前一個階段最佳化掉那些重複的記錄。因此,MySQL需要再次去掉重複的記錄,然後再把結果傳送給客戶端。
Reopen table
獲得了對一個表的鎖,但是必須在表結構修改之後才能獲得這個鎖。已經釋放鎖,關閉資料表,正嘗試重新開啟資料表。
Repair by sorting
修復指令正在排序以建立索引。
Repair with keycache
修復指令正在利用索引快取一個一個地建立新索引。它會比Repair by sorting慢些。
Searching rows for update
正在講符合條件的記錄找出來以備更新。它必須在UPDATE要修改相關的記錄之前就完成了。
Sleeping
正在等待客戶端傳送新請求.
System lock
正在等待取得一個外部的系統鎖。如果當前沒有執行多個mysqld伺服器同時請求同一個表,那麼可以透過增加--skip-external-locking引數來禁止外部系統鎖。
Upgrading lock
INSERT DELAYED正在嘗試取得一個鎖表以插入新記錄。
Updating
正在搜尋匹配的記錄,並且修改它們。
User Lock
正在等待GET_LOCK()。
Waiting for tables
該執行緒得到通知,資料表結構已經被修改了,需要重新開啟資料表以取得新的結構。然後,為了能的重新開啟資料表,必須等到所有其他執行緒關閉這個表。以下幾種情況下會產生這個通知:FLUSH TABLES tbl_name, ALTER TABLE, RENAME TABLE, REPAIR TABLE, ANALYZE TABLE,或OPTIMIZE TABLE。
waiting for handler insert
INSERT DELAYED已經處理完了所有待處理的插入操作,正在等待新的請求。
大部分狀態對應很快的操作,只要有一個執行緒保持同一個狀態好幾秒鐘,那麼可能是有問題發生了,需要檢查一下。
還有其他的狀態沒在上面中列出來,不過它們大部分只是在檢視伺服器是否有存在錯誤是才用得著。
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, for ANALYZE 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, you should 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 was larger than tmp_table_size and 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 a MyISAM 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 be Copying 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 or ALTER 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. This state is usually followed by cleaning 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.
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.
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.
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, an ALTER TABLE or a LOCK TABLE statement can prevent opening a table until the statement is finished.
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 than Repair 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, the AUTO_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 the UPDATE is changing the index that is used to find the involved rows.
Sending data
The thread is processing rows for a SELECT statement and also is sending data to the client.
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.
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 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).
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.
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 a GET_LOCK() call. For SHOW PROFILE, this state means the thread is requesting the lock (not waiting for it).
Waiting for tables, Waiting for table
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.
Waiting on cond
A generic state in which the thread is waiting for a condition to become true. No specific state information is available.
Writing to net
The server is writing a packet to the network.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/21601207/viewspace-683077/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql的show processlistMySql
- MySQL 之 show processlist 神器MySql
- mysql show processlist 詳解MySql
- MySQL show processlist故障處理MySql
- Mysql show processlist 排查問題MySql
- 轉載:mysql的show processlistMySql
- mysql show processlist命令詳解MySql
- MySQL 中 show full processlist 詳解MySql
- MySQL:show processlist Time負數的思考MySql
- MySQL8 show processlist 最佳化MySql
- MySQL調優使用者監控之show processlistMySql
- show processlist time負數的初探
- MySQL show processlist命令詳解及檢視當前連線數MySql
- mysql processlistMySql
- 故障分析 | show processlist 引起的效能問題
- 12、MySQL Case-show processlist 狀態一直處於Sending to clientMySqlclient
- SHOW PROCESSLIST 最多能顯示多長的 SQL?SQL
- 批量kill mysql processlist程式MySql
- mysql processlist詳細說明MySql
- mysql show命令MySql
- MySQL 5.5 SHOW PROFILE、SHOW PROFILES語句介紹MySql
- Mysql---show table statusMySql
- MYSQL SHOW VARIABLES簡介MySql
- MySQL SHOW 語句大全MySql
- MySQL中的show命令MySql
- 【MySQL】常見的mysql 程式stateMySql
- 【MySQL】SHOW WARNINGS和SHOW ERRORS的作用是什麼?MySqlError
- MySQL show status 命令詳解MySql
- MySQL的show engine innodb statusMySql
- MySQL SHOW STATUS命令介紹MySql
- mysql show命令用法大全MySql
- MySQL 索引 效能分析 show profilesMySql索引
- mysql連結很多,批量刪除異常程式processlistMySql
- MySQL高階知識——Show ProfileMySql
- MySQL中show命令用法大全MySql
- MySQL show engine innodb status 詳解MySql
- MySQL Show命令的用法大全MySql
- 【Mysql】show engine innodb status詳解MySql