Home >Database >Mysql Tutorial >Under what circumstances should sql optimization be performed in MySQL?

Under what circumstances should sql optimization be performed in MySQL?

王林
王林forward
2023-04-17 19:49:01855browse

Introduction to sql optimization

1. Under what circumstances should sql optimization be performed?

Low performance, too long execution time, too long waiting time, connection query, and index failure .

2. SQL statement execution process

(1) Writing process

select distinct ... from ... join ... on ... where ... group by ... having ... order by ... limit ...

(2) Parsing process

from ... on ... join ... where ... group by ... having ... select distinct ... order by ... limit ...

3. SQL optimization is to optimize the index

The index is equivalent to the table of contents of the book.

The data structure of the index is a B-tree.

The above is the detailed content of Under what circumstances should sql optimization be performed in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete