This is a fairly straight forward question but I’m having a problem finding a clear answer googling around. On MySQL 5.1.53, using InnoDB, and a varchar(1024) field (I’m indexing Exchange 2010 Event IDs). I’m wondering what the maximum key length is when I index this field. I’m wondering if I should shorten the field and use something like an sha512 hash if the key length isn’t long enough.
Share
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.
And, as noted:
An index key for a single-column index can be up to 767 bytes. The same length limit applies to any index key prefix. See Section 12.1.13, “CREATE INDEX Syntax”.
http://dev.mysql.com/doc/refman/5.1/en/innodb-restrictions.html