[MySQL] about the sleep status during MySQL execution

Source: Internet
Author: User

When I use a Python script to update a MySQL table, I want to know the update details. So show processlist; after a while, we found that the process to which the script belongs is in sleep state. Run the show processlist command again, and the process resumes working.As shown in:


This repetition indicates that the process did not release resources in time after performing MySQL update or query operations. After a rough thought, when the MySQL connection is in sleep state, the Python script should still be calculating some data, but it has not been able to close () the connection or execute the next table operation.

I asked my predecessors and searched for information, and found that the facts are basically the same. During the database connection, the two major steps such as computing data and updating table data are repeated. Therefore, the MySQL execution status is always in sleep and working state.

Although it is a normal phenomenon, if sleep takes a long time, it may cause a loss of query and other operation efficiency, and optimization should be considered.

References:MySQL execution Status Analysis

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.