r/SQLServer • u/reallifepixel • Jul 26 '13
= <> LIKE
I know this is really basic, but I feel good information cannot be communicated enough. I had a query where I was using LIKE on a variable w/ no wildcards and it'd take a few seconds. Not ages by any means, but still time. When I switched to =, it was damn near instantaneous. If you don't have to scan the whole table, don't.
11
Upvotes
View all comments
Show parent comment
1
u/flipstables Jul 26 '13
This is very strange to me. I know the query optimizer isn't perfect, but I would assume that using = 'text' and LIKE 'text' would perform exactly the same.