How MySQL is going to use these indexes (explain tools), need to find out whether the index is being used reasonably, and prevent the index from abusing. ?
Note: Indexes are helpful for queries, but there is no benefit to updating them. The index should be established reasonably.
?
a general idea for MySQL tuning (interview questions) : MySQL can be tuned with the above steps, You can use MySQL to work optimally, as long as the above steps are repeated and executed repeatedly.
?
Profile Definition: A tool provided by MySQL that can parse SQL statements Execute procedures , It gives you a general idea of how MySQL will execute the SQL statements that the user passes over.
Use
Whenever you want to precede the corresponding SQL statement with the keyword explain or synonyms desc
# desc SELECT * from tableName where id = 1000000;
# explain select * from tableName where id = 1000000;
The above two SQL execution effect is equivalent.
?
You can compare indexed and non-indexed execution plans in a simple first step:
no_index without Index Analysis:
?
rows: represents the result of the query satisfying the SQL statement and may require querying the number of rows.
?
id the existence of a primary key index:
?
Type: Critical analysis
?
Const, which represents the primary key index used. Development, try to appear this. Constant Lookup?
3. Range represents a range operation, and the index can also be used when the SQL statement being executed is a range lookup.
range Meaning: because the index is a well-ordered structure. Along this orderly structure, and then to intercept a sequence of data, it can be used on the index.
?
?
Interview question: What kind of field is appropriate for indexing? (What are the considerations when building an index?) )
For: