MySQL2: What are the reasons for the slow execution of a SQL statement?

A SQL execution is very slow, we have to discuss in two cases:

 

1. It is normal in most cases, and occasionally very slow, there are the following reasons

 

(1) The database is flushing dirty pages, for example, redo log is full and needs to be synchronized to disk.

 

(2) When executing, it encounters locks, such as table locks and row locks.

 

2. This SQL statement has been executed very slowly, for the following reasons.

 

(1). Index is not used: For example, the field has no index; the index cannot be used due to operations and function operations on the field.

 

(2) The wrong index is selected for the database.

 

 

Guess you like

Origin blog.csdn.net/qq_42198024/article/details/108528908