MySQL Troubleshooting database execution slow through show processlist

Source: Internet
Author: User

RDS for MySQL is using the InnoDB engine. Unlike the MyISAM engine, which provides only table locks, InnoDB provides different levels of locks. However, in our daily operations, due to improper SQL operations on the database caused a long lock, causing other SQL statements to wait for a long time to execute. This phenomenon is a great hindrance to the normal use of the database. Next we'll show you how to troubleshoot whether the current instance appears in this state.

First, the user can log in to RDS (available through the client, DMS, and other tools) to execute the command in the database:

Show Processlist

Execution Result:

Let's start by describing the meanings of the following fields:

ID, the identity of the process;

User, show current users;

Host, showing the source IP and port;

DB, displaying the currently connected database;

command, which shows the execution of the current connection, is usually sleep (sleep), query, connection (connect);

Time, the duration of this state, the unit is seconds;

The State column, which displays the status of the SQL statement using the current connection, is an important column;

Info, which shows this SQL statement, because the length is limited, so long SQL statements are not complete, but an important basis for judging the problem statement.

"Waiting for Table metadata lock" appears when a user's SQL is causing another SQL to wait for a lock, and if that happens, it causes a lot of SQL build-up and an exception to the instance state. So at this point the user is required to kill the query that causes the other SQL to wait for the lock based on the previous ID, and then the other statements will execute normally.

MySQL Troubleshooting database execution slow through show processlist

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.