索引优化
CREATE [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name
[index_type]
ON tbl_name (index_col_name,...)
[index_option]
[algorithm_option | lock_option] ...
index_col_name:
col_name [(length)] [ASC | DESC]
index_option:
KEY_BLOCK_SIZE [=] value
| index_type
| WITH PARSER parser_name
| COMMENT 'string'
| {VISIBLE | INVISIBLE}
index_type:
USING {BTREE | HASH}
algorithm_option:
ALGORITHM [=] {DEFAULT|INPLACE|COPY}
lock_option:
LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}索引的类型
B-Tree索引
哈希索引
索引策略
独立的列
前缀索引和索引选择性
多列索引
选择合适的索引列顺序
聚簇索引
覆盖索引
使用索引扫描来做排序
冗余和重复索引

索引与锁
维护索引和表
找到并修复损坏的表
更新索引统计信息
减少索引和数据碎片
Last updated