Purely in performance terms, how do CONTAINS([MyCol], 'foo') and [MyCol] LIKE '%foo%' compare?
0
votes
0
answers
46
views
Consider
CONTAINS([MyCol], 'foo')
and [MyCol] LIKE '%foo%'
. Assume the best possible indexes on [MyCol]
, whatever those may be (at minimum, we need a unique key and a full-text index). I know that the two expressions are not equivalent, but how do their performance characteristics compare?
Assume SQL Server 2019. I am asking because I have inherited a codebase where the first expression was frequently preferred over the second, without any documentation explaining why.
Asked by J. Mini
(1235 rep)
Mar 18, 2024, 08:10 PM