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