只有blob和text类型的列在创建索引时,mysql才强制要求需要指定索引的前缀长度(键长度)

只有blob和text类型的列在创建索引时,mysql才强制要求需要指定索引的前缀长度(键长度)
This commit is contained in:
何正海 2020-04-19 01:38:28 +08:00 committed by GitHub
parent 5d14e3ecaf
commit 2952f82f39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,6 +166,7 @@ CREATE TABLE test (blob_col BLOB, INDEX(blob_col(10)));
https://dev.mysql.com/doc/refman/5.7/en/column-indexes.html#column-indexes-prefix
对于VARCHAR和CHAR类型的列不强制要求使用前缀索引根据业务自行选择即可
前缀长度的选取需要根据索引选择性来确定
### 5. 覆盖索引