EXPLAIN for query optimization different SQL statement writing methods often lead to great performance differences. How can we know the SQL query execution overhead? MySQL provides the EXPLAIN keyword for us. When you add the EXPLAIN keyword before your select statement, MySQL will EXPLAIN how it processes the SELECT query and provide the order of how the table is joined and joined, the number of scanned records and other related information can be used to optimize your SQL query. EXPLAIN select id, username from userinfo where username like '% peng %'; we added the EXPLAIN keyword before the query statement, then we can get the following report. Id: 1select_type: SIMPLEtable: userinfotype: ALLpossible_keys: NULLkey: NULLkey_len: NULLrel: NULLrows: 6 Extra: Using where describes the meaning of each data item: id: SELECT identifier, SELECT query serial number; select_type: SELECT type, which can be SIMPLE (SIMPLE query), PRIMARY (outermost select), etc.; table: used table type: Join type possible_keys: available index column key: actually used index column key_len: key Length rel: Which column or constant is used together with the key to select the row rows from the table: the number of checked rows Extra: this column contains MySQL solution query details. For more detailed explanations, please refer to the MySQL manual. Here, it is meaningless to copy the manual content again, when you have these reference numbers MySQL query optimization can be completed more accurately.