8.3 Optimization and Indexes优化与索引

8.3.1 How MySQL Uses IndexesMySQL如何使用索引
8.3.2 Primary Key Optimization主键优化
8.3.3 SPATIAL Index Optimization空间索引优化
8.3.4 Foreign Key Optimization外键优化
8.3.5 Column Indexes列索引
8.3.6 Multiple-Column Indexes多列索引
8.3.7 Verifying Index Usage验证索引用法
8.3.8 InnoDB and MyISAM Index Statistics CollectionInnoDB和MyISAM索引统计集合
8.3.9 Comparison of B-Tree and Hash IndexesB-树和散列索引的比较
8.3.10 Use of Index Extensions索引扩展的使用
8.3.11 Optimizer Use of Generated Column Indexes优化器使用生成的列索引
8.3.12 Invisible Indexes不可见索引
8.3.13 Descending Indexes降序索引
8.3.14 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. 索引项的作用类似于指向表行的指针,允许查询快速确定哪些行与WHERE子句中的条件匹配,并检索这些行的其他列值。All MySQL data types can be indexed.所有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.您必须找到正确的平衡,才能使用最佳索引集实现快速查询。

8.3.1 How MySQL Uses Indexes
8.3.2 Primary Key Optimization
8.3.3 SPATIAL Index Optimization
8.3.4 Foreign Key Optimization
8.3.5 Column Indexes
8.3.6 Multiple-Column Indexes
8.3.7 Verifying Index Usage
8.3.8 InnoDB and MyISAM Index Statistics Collection
8.3.9 Comparison of B-Tree and Hash Indexes
8.3.10 Use of Index Extensions
8.3.11 Optimizer Use of Generated Column Indexes
8.3.12 Invisible Indexes
8.3.13 Descending Indexes
8.3.14 Indexed Lookups from TIMESTAMP Columns