8.3.2 Primary Key Optimization
8.3.3 Foreign Key Optimization
8.3.7 InnoDB and MyISAM Index Statistics Collection
8.3.8 Comparison of B-Tree and Hash Indexes
8.3.10 Optimizer Use of Generated Column Indexes
8.3.11 Indexed Lookups from TIMESTAMP Columns
The best way to improve the performance of SELECT operations is to create indexes on one or more of the columns that are tested in the query.
提高SELECT操作性能的最佳方法是在查询中测试的一个或多个列上创建索引
The index entries act like pointers to the table rows, allowing the query to quickly determine which rows match a condition in the WHERE
clause, and retrieve the other column values for those rows. All MySQL data types can be indexed.
引项的作用类似于指向表行的指针,允许查询快速确定哪些行匹配WHERE子句中的条件,并检索这些行的其他列值。所有MySQL数据类型都可以被索引。
Although it can be tempting to create an indexes for every possible column used in a query, unnecessary indexes waste space and waste time for MySQL to determine which indexes to use.
尽管为查询中使用的每一列创建索引很诱人,但不必要的索引会浪费MySQL确定使用哪个索引的空间和时间。
Indexes also add to the cost of inserts, updates, and deletes because each index must be updated. You must find the right balance to achieve fast queries using the optimal set of indexes.
索引还会增加插入、更新和删除的成本,因为每个索引都必须更新。您必须找到正确的平衡,以使用最优索引集实现快速查询。