MySQL execution process
We can manually divide the main functions of MySQL into the following modules.
1. Initialize the module
When MySQL starts to perform initialization work, such as reading the configuration file, assigning some global variables (sql_model,catch buffer), loading the control table, memory allocation, and so on, after the initialization module executes, the controller is handed over to the
Chain receiver Manager
2. Execution process
A user connects to the Connection management module first, and then the connection management module notifies the thread management module to assign a thread to the user module to authenticate the user, when the user module is finished, the server can accept the command from the client, the command sent by the user is passed to the command dispenser,
In the command dispatcher, adding is a query statement, he will go to the query cache module to see if it is cached (as long as we cache this query to open), command dispatcher he will also notify the log module to save our commands, put into the general_log inside, And I didn't wait for the order to finish, so I got a record.
Below, the command dispatcher passes the command to the command parser, sending commands to different modules such as query optimizer (DML), table change module (DDL), table maintenance module (check, compress), replication module, state module (state variable, server information) through the parsing of the command parser
And then they call the access control module according to their own needs. Access control module A list of tables is sent, which detects that the user has no permissions on the table or column permissions He will give the controller to the Table Management Module table Management module will read from the. frm file, or take a lock, when it is done, it calls the storage Engine interface to implement.
MySQL execution process