Recently I discovered that charindex works 3 times faster with a partial search. I can’t imagine why this is so ... It seems that there is a partial coincidence both there and there. I also don’t understand why the optimizer doesn’t convert like to charindex when using only% without other wildcard characters, as is done if a like doesn’t use%. What kind of magic?
|
%. And yes, it may be slower simply because it has a much more complicated algorithm with returns, in order to support these very substitutions. And the fact that they are not used in a particular case - this does not change the algorithm. Why the optimizer does not change: does not know how, did not teach, suggest this idea to the developers of MS SQL - Mike