MySQL 8.4 Release Notes
10.3 优化 and Indexes
- 10.3.1 How MySQL Uses 索引
- 10.3.2 Primary Key 优化
- 10.3.3 SPATIAL Index 优化
- 10.3.4 Foreign Key 优化
- 10.3.5 Column 索引
- 10.3.6 Multiple-Column 索引
- 10.3.7 验证索引使用情况
- 10.3.8 InnoDB和MyISAM索引统计信息收集
- 10.3.9 Comparison of B-Tree and Hash 索引
- 10.3.10 索引扩展的使用
- 10.3.11 Optimizer Use of Generated Column 索引
- 10.3.12 Invisible 索引
- 10.3.13 Descending 索引
- 10.3.14 从TIMESTAMP列进行索引查找
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. 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.
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. 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.