MySQL多列主键

多列主键(MySQL)的最大列数是多少?它取决于列数据类型还是引擎?
最佳答案
是的,这取决于存储引擎.

> MyISAM

The maximum number of columns per index is 16. The maximum key length
is 1000 bytes. This can also be changed by changing the source and
recompiling. For the case of a key longer than 250 bytes, a larger key
block size than the default of 1024 bytes is used.

> InnoDB

The InnoDB internal maximum key length is 3500 bytes, but MySQL itself
restricts this to 3072 bytes. This limit applies to the length of the
combined index key in a multi-column index.

转载注明原文:MySQL多列主键 - 代码日志