索引的大小限制
- CHAR、VARCHAR、BINARY 和 VARBINARY 类型的字段创建索引时可以指定索引占用字节数
- BLOB 和 TEXT 类型的字段创建索引时必须指定索引占用字节数(取对应字段的前缀)
- InnoDB 表创建的索引最多不能超过 767 个字节(REDUNDANT or COMPACT row format)或 3072 个字节(DYNAMIC or COMPRESSED row format)
- MyISAM 引擎创建的索引不能超过 1000 字节(超出时会报错,或者自动减少为限制的最大值)
compact row format
A row format for InnoDB tables. It was the default row format from MySQL 5.0.3 to MySQL 5.7.8. In MySQL 8.0, the default row format is defined by the innodb_default_row_format configuration option, which has a default setting of DYNAMIC. The COMPACT row format provides a more compact representation for nulls and variable-length columns than the REDUNDANT row format.
https://dev.mysql.com/doc/refman/8.0/en/innodb-row-format.html
row_format