3 ms·
> they would now need to store max 4N bytes, which (with a high N) can exceed internal limits such as maximum length of an index key. Specifically, indexes are
by chrismorgan 5y ago
> they would now need to store max 4N bytes, which (with a high N) can exceed internal limits such as maximum length of an index key.
Specifically, indexes are limited to 767 bytes (some say 768?), which means 191 utf8mb4 characters. So your otherwise-innocuous VARCHAR(255) primary key breaks. I’ve seen this multiple times, e.g. django-celery probably still has this: https://github.com/celery/django-celery/issues/259 https://github.com/celery/django-celery/issues/259.
- evanelias 5y agofwiw the limit is effectively 3072 bytes nowadays, default since MySQL 5.7. You could actually bump it up to 3072 in 5.5 and 5.6 too, but it required changing several settings (innodb_large_prefix, innodb_file_format, innodb_file_per_table, and the table's ROW_FORMAT).
- chrismorgan 5y agoCool, didn’t know that; thanks for the correction. I haven’t touched MySQL since 2016, and I suppose what I worked with then wasn’t 5.7, or was configured differently for historical reasons, or something.