Mysql three of relational database: start from the life cycle of a sql
The mysql tutorial column introduces the life cycle of SQL in relational databases. Connector: Establish a connection with MySQL for querying SQL statements and judging permissions. Query cache: If the statement is not in the query cache, it will continue to the subsequent execution phase. After the execution is completed, the execution result will be stored in the query cache If the query hits the cache, MySQL can directly return the result without performing the following complex operations, improving efficiency Analyzer: Perform hard parsing of SQL statements, and the analyzer will first perform lexical analysis. Analyze the components of an SQL statement. Determine whether the input SQL statement satisfies the grammatical rules. Optimizer: The optimizer decides which index to use when there are multiple indexes in the table; or when there are multiple indexes in a statement When tables are joined (join), the connection order of each table is determined. The logical results of different execution methods are the same, but the execution efficiency will be different, and the role of the optimizer is to decide which solution to use. Executor: With index: the first call is to fetch the first line that meets the conditions, and then loop This…