Although the restriction may seem ridiculous, it makes you wonder if you really need an index for such a long varchar field. Even with 767 bytes, the size of the index grows very quickly, and for a large table (where it is most useful), it most likely does not fit in memory.
On the other hand, the only frequent case, at least in my experience, when I needed to index a long varchar field, was a unique constraint. And in all these cases, the composite index of some group identifier and MD5 from the varchar field were sufficient. The only problem is to match case-insensitive sorting (which considers accented characters and non-accented equal ones), although in all my cases I used binary sorting anyway, so this is not a problem.
UPD Another common case for indexing a long cook is ordering. In this case, I usually define a separate indexed sorter field, which is a prefix of 5-15 characters depending on the distribution of data. For me, a compact index is preferable to a rare, inaccurate order.
source share