SQL Server uses high CPU when searching inside nvarchar strings

前端 未结 5 863
孤独总比滥情好
孤独总比滥情好 2020-12-08 15:05

Check out the following example. It shows that searching within a unicode string (nvarchar) is almost eight times as bad as searching within a varchar string. And on par wit

5条回答
  •  伪装坚强ぢ
    2020-12-08 15:11

    My guess is that LIKE is implemented using an O(n^2) algorithm as opposed to an O(n) algorithm; it would probably have to be for the leading % to work. Since the Unicode string is twice as long, that seems consistent with your numbers.

提交回复
热议问题