The show processlist command is very useful. Sometimes MySQL often runs to more than 50% or more, so you need to use this command to see which SQL statement occupies more resources, so you can know which website has a program problem. The output of the show processlist command shows which threads are running, which can help identify problematic queries. If you have the SUPER privilege, you can see all threads. Otherwise, you can only see the threads you initiated (the threads running under the current MySQL account). Let me first briefly talk about the meaning and purpose of each column The first column, id, is a flag, which is very useful when you want to kill a statement.
The most critical part of this command is the state column. The states listed by MySQL are mainly the following: Checking data tables (this is automatic). The modified data in the table is being flushed to disk, and the table that has been used is being closed. This is a very quick operation, but if it is not, you should check to see if the disk is full or if the disk is under heavy load. The replication slave server is connecting to the master server. Since the temporary result set is larger than tmp_table_size, the temporary table is being converted from memory storage to disk storage to save memory. Creating a temporary table to hold partial query results. The server is executing the first part of a multiple-table delete and has just deleted the first table. The server is executing the second part of a multi-table delete and is deleting records from other tables. FLUSH TABLES is being executed, waiting for other threads to close the data table. If a kill request is sent to a thread, the thread will check the kill flag and abandon the next kill request. MySQL checks the kill flag in each main loop, but in some cases it may take a while for the thread to die. If the thread is locked by other threads, the kill request will take effect immediately when the lock is released. Locked by another query. The records of the Select query are being processed and the results are being sent to the client. Sorting for GROUP BY. Sorting for ORDER BY. This process should be quick unless interfered with by other factors. For example, the data table cannot be opened by other threads until the Alter TABLE or LOCK TABLE statement is completed. Trying to open a table. A Select DISTINCT query is being executed, but MySQL was unable to optimize away the duplicate records in the previous stage. Therefore, MySQL needs to remove duplicate records again and then send the results to the client. A lock on a table is obtained, but the lock can only be obtained after the table structure is modified. The lock has been released, the table has been closed, and an attempt is being made to reopen the table. Fix instructions being sorted to create index. The repair instruction is creating new indexes one by one using the index cache. It will be slower than Repair by sorting. The records that meet the conditions are being found for update. It must be completed before Update can modify related records. Waiting for new client request. Waiting to acquire an external system lock. If you are not running multiple mysqld servers requesting the same table at the same time, you can disable external system locks by adding the --skip-external-locking parameter. Insert DELAYED is trying to acquire a table lock to insert a new record. Searching for matching records and modifying them. Waiting for GET_LOCK(). The thread is notified that the data table structure has been modified and needs to be reopened to obtain the new structure. Then, in order to reopen the data table, you must wait until all other threads close the table. This notification is generated in the following situations: FLUSH TABLES tbl_name, Alter TABLE, RENAME TABLE, REPAIR TABLE, ANALYZE TABLE, or OPTIMIZE TABLE. Insert DELAYED has processed all pending insert operations and is waiting for new requests. Most states correspond to very fast operations. If a thread remains in the same state for several seconds, there may be a problem and it needs to be checked. There are other statuses not listed above, but most of them are only useful to see if there are any errors with the server. Common counters Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links You may also be interested in:
|
<<: About React Native unable to link to the simulator
MariaDB is installed by default in CentOS, which ...
1. Alipay method: Alipay method: Click Alipay to ...
This article example shares the specific code of ...
First, let’s take a look at the picture: Today we...
1Basic steps of echarts Four Steps 1 Find the DOM...
Table of contents background Achieve a similar ef...
MySQL full-text index is a special index that gen...
Preface: I believe that those who need to underst...
1. To develop web responsively, the page must ada...
The width of the parent container is fixed. In or...
Table of contents 1. Brief Overview 2. Detailed e...
Recently, when I installed MySQL in Docker, I fou...
Table of contents Method 1 Method 2 After install...
HTML imitates the Baidu Encyclopedia navigation d...
Open the decompressed directory of tomcat and you...