Is there any build-in functionality in MySQL to do the above without scanning the entire table?
Only solution I found is to store a mirrored version of the column I want to compare and do a like 'txet%'.
I also don’t see a way of getting around the postfix-search. It is for a German dictionary. Many words have a version with prefix, e.g. the user searches for “Gericht” (Engl. curt), but it is also valuable to know that there is a word “Amtsgericht” (Engl. district curt). Unfortunately often there is no space separating the two parts of the word in German language. Approx 15% of queries actually use the prefix-search.
A index over reverse field will be the solution, some think like:
but MySQL don’t alow index over expressions, only over columns:
this is MySQL create index syntax:
This is postgres create index syntax:
A work around may be create indexed second field (field -> dleif) and a mysql trigger to keep reversed field: