Mysql 1071 Specified key was too long
in Co-De with 21365 comments

Mysql 1071 Specified key was too long

in Co-De with 21365 comments

there is a index key limit

for single key limit:

the total key length limit is hard check.

for case
SomeCol varchar(1000)

if innoDB+utf8, it works use someCol to create index when large-prefix on (3*1000=3000)
if innoDB+utf8mb4, it not work as large than 3072(4*1000 = 4000)

other solutions
for index base on large colums, mysql offer prefix index, as only use a part of the colum value as index.

请输入图片描述

Comments are closed.