0

If there is a very large table T1(Id INT, Name VARCHAR(MAX), Category VARCHAR(MAX)) and Category is INDEX UNIQUE NONCLUSTERED, does it matter the order of operands if I do the select like

SELECT * FROM T1 WHERE Name = 'name' and Category = 'cat'

vs

SELECT * FROM T1 WHERE Category = 'cat' and Name = 'name'

?

kord
  • 979
  • 14
  • 24

2 Answers2

1

Theres isnt any difference, you db planner will parse the code and choose the better option.

What is interesting is the order of execution can change if table sizes change. But how you write it wont.

Juan Carlos Oropeza
  • 47,252
  • 12
  • 78
  • 118
0

There might be a difference based on which indexes you have on the table. Check actual execution plan to see what sql decides to use

vittore
  • 17,449
  • 6
  • 44
  • 82