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 what is the "star". Does ms sql have any non-standard wildcards (I don’t see this in the msdn.microsoft.com/ru-ru/library/ms179859 (v=sql.120 ) .aspx documentation)? like wildcard usually % . 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
  • @Mike, yes, I reserved% meant. - iluxa1810

0