Connector
Establishing a link is more complicated. It is recommended to use a long connection. Note that the memory temporarily used by mysql during execution is managed in the connection object.It will only be released when the link is broken.
Solution: 1. Disconnect the link regularly (the general agent layer will do it) 2. Can be used after 5.7mysql_reset_connectionTo initialize the link resource
Show processlist ; -- Check all connections.Copy code
Cache
The key value is stored in the form, the key is the sql statement, and the value is the query result. Caching is not recommended.
Cache suitable for scenes, static tables, such as system configuration table, mysql8.0 completely delete the cache
Analyzer
In addition to this method analysis, it is determined whether the table and the field exist. Both are solved at the analyzer level.
Optimizer
After the parser, mysql already knows what to do, and it needs to be optimized before it is done again. For example, the following sql
select * from t1 join t2 using(ID) where t1.a = 1 and t2.b = 1;Copy code
1. Execute t1 and find a=1, associate t2, and find the value of t2.b=1.
2. Execute t2 and find b=1, associate t1, and find the value of t1.a=1.
The specific use of that rule is determined by the optimizer.
Actuator
Mysql knows what to do through the parser. byThe optimizer knows what to do. Then enter the actuator
First determine whether there is permission, if there is an interface that will call the storage engine, such as the following sql
select * from T where name = 't'; -- name no indexCopy code
1. The innodb storage engine will take the first row of the table, determine whether name is equal to t, not skip, yes to the result set
2. Take the next line and repeat the same logic until you have traversed all the results and then return the satisfied result set to the client.
The rows_examined field in the slow query log can be used until the number of rows scanned by this statement.