I would start with an SQL function to calculate the Levenshtein distance (in T-SQl or .Net) (yes, I am a MS person ...) with the maximum distance parameter, which will lead to early termination.
You can then use this function to compare your input with each line to check for distanve and move on to the next one if it violates the threshold.
I also thought that you could, for example, set the maximum distance to 2, and then filter out all words that are longer than 1, while the first letter is different. With an index, it can be a little faster.
You can also use shortcuts to return all rows that are perfect matches (indexing will speed this up), since it actually takes longer to calculate Levenshtein distance 0.
Just thoughts...
source share