Timeline for Mariadb error 1071: Specified key was too long; max key length is 1000 bytes
Current License: CC BY-SA 4.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 1, 2021 at 16:51 | comment | added | Rick James |
The engine comes from either explicitly declaring it when the table is created, or from a default in the config. Constraints, FKs, etc are simply ignored by MyISAM. I mentioned the 255 because it factors into the 1000 limit, and you could still hit a different limit in InnoDB. Do something like SELECT MAX(CHAR_LENGTH(col)) FROM tbl; to see what the longest text for col . Then use ALTER to adjust it down to some max that is somewhere between the max and 255. For example, hardly any kind of "name" (person, city, etc) is longer than 70.
|
|
Feb 1, 2021 at 8:08 | comment | added | meh | You were right, most tables were created as innodb (probably because they were declared with constraints) so I missed that detail. Also, not my application, so I'd rather not mess with field length. | |
Feb 1, 2021 at 8:06 | vote | accept | meh | ||
Jan 30, 2021 at 4:06 | history | answered | Rick James | CC BY-SA 4.0 |