The harm of slow query in MySQL database

Source: Internet
Author: User
Tags create index
1, MySQL database when the slow query, is more dangerous, once there are other DDL operations, may cause the entire database waiting

Can be divided into the following situations:

When the table is a MyISAM table, the table has a slow query, does not block the Select, other DML,DDL operations on the table will be blocked, such as the wating for table level lock, the database must not exist MyISAM table

When the table is a InnoDB table, when there are slow queries on the table, without blocking select and DML, other DDL operations are blocked, such as the waiting for table metadata lock


In summary, when there is a slow query in the database, it is more dangerous, when performing backups, create INDEX, ALTER TABLE, flush table and other operations will cause the database waiting


Workaround:

1, the database in the execution of a long time to monitor the select, and timely alarm

2. If allowed, write a script, find a longer SELECT statement, kill directly, and log

The harm of slow query in MySQL database

Related Article

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.