The principle of Mysql, basic use

mysql execution process:


MySQL is a single-process service, and each request is responded to by a thread, which requires a connector to handle the new user's request, response, and destruction


1. The client requests, the server (connector) opens a thread to respond to the user

2. The user initiates a SQL statement to query the database

3. Query cache: record the user's SQL query statement, if the same content is queried again, it will return to the cache

4. If there is no cache Enter the analyzer: (The analyzer may also borrow a signature cache)

Syntax analyzer: Whether the syntax of the user command is correct

Lexical analyzer: Slice the user's command, and separate words by spaces to obtain the table and content that the user wants to query. , user permissions, etc.

5. Optimization: selection of execution paths, generating an execution tree.

Each SQL statement has many execution paths. The purpose of optimization is to select an optimal execution path among these execution paths.

6. Storage engine: used for Manage data management programs stored in the file system or even on raw devices. It itself provides different management for upper-layer applications, some support transactions, and some do not support transactions.

#Query caching can greatly speed up this process, but the cache itself may bring disadvantages. If a user wants to query a piece of data, it happens to be in the cache, and before this data has just been modified, the returned cached result is outdated.

{{o.name}}
{{m.name}}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324148318&siteId=291194637