What is the maximum columns number for a multicolumn primary key (MySQL)? Does it depend on column data type or engine?
Yes, it depends on storage engine.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With