We have a clustered index in table Tbl with order of A,B,C.
Does it make senses to write a query to have
WHERE A = @a, B = @b, C = @c
or it'll be as same as
WHERE C = @c, B = @b, A = @a
Does the order of query make sense for clustered index?
clustered-indexperformancequery-performancesql servert-sql
We have a clustered index in table Tbl with order of A,B,C.
Does it make senses to write a query to have
WHERE A = @a, B = @b, C = @c
or it'll be as same as
WHERE C = @c, B = @b, A = @a
Does the order of query make sense for clustered index?
Best Answer
It makes no difference: the optimiser evaluates the query and will work out predicate order for itself, matching a suitable index and all the other good stuff it does.
This is because SQL is "declarative" not "procedural": you say what you want, not how to do it.
It's nicer to read though...