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

Mysql 1071 Specified key was too long

in sqlCo-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.

Prefix Index

mysql-error-1071-specified-key-was-too-long-max-key-length-is-767-bytes

Comments are closed.