Location>code7788 >text

Execution flow of mysql

Popularity:705 ℃/2024-10-22 10:21:45
1, first of all a sql in the execution of sql will be transmitted to mysql through the network
2, in Mysql after receiving the sql statement will be first in the analyzer to determine whether the SQL statement has syntax errors.
3, after judging the syntax after the syntax is correct, the optimizer will be based on the sql you write to determine what index to execute. (Here is a more important point of knowledge)
4, the executor will call the interface function of the storage engine. (The storage engine is the real place to read and write data is now commonly used InnoDB storage engine)
5, SQL to InnoDB will be calculated according to the previous optimizer in the index to query the corresponding index page, in the index page through theQueries the location of the data page.(Here just know the location!)
(Because reading and writing directly to disk is slow, InnoDB adds a layer of Buffer Pool memory to speed things up.)
(The Buffer Pool holds both row data and indexes, and if the index page is not in the Buffer Pool memory, it goes to disk to load the index page.)
6. Finally, the results of a line of data will be returned to the client.