4 Comments
User's avatar
Haripriya SB's avatar

The last example is not ‘instead of- use this’. I mentioned it to say to make careful use of wildcard characters. Using % at the beginning will make the query non-SARGable, so if you know what the first characters are, avoid using % sign as first character to make the query SARGable.

Expand full comment
Willem's avatar

Hi, very useful and concise article!

I think you made a typo in the Summary, where you write 'NOT, LIKE' in the Non-SARGable column. I presume that should be 'NOT LIKE', without the comma.

Willem

Expand full comment
Adi Cohn's avatar

I agree with most of the things that you wrote, but I do not agree with the last example. When ever we optimize a query it is important that we will get the same results. The optimization should improve the performance without modifying the query's results. In you last example, there is no argument that performance wise removing the wild card from the beginning of the phrase can dramatically improve the performance, but it will also change the query's results.

Expand full comment
Matt Wigdahl's avatar

I certainly agree, but I thought that example was pretty clear in stating it was simply showing the difference in execution plan between a leading wildcard query and one without a leading wildcard.

Expand full comment