Dave Carlile
Dave Carlile

Reputation: 7467

Does parameter passing order affect the caching of query plans?

Does the order in which parameters are passed to a stored procedure affect the caching of query plans, or cause any other sort of extra processing overhead?

My theory is "no" for the query plans, and any processing overhead required to re-order the parameters is negligible, but I'd like to find some information to back it up.

Upvotes: 1

Views: 175

Answers (2)

OMG Ponies
OMG Ponies

Reputation: 332691

No, order of parameters does not matter. The value is what matters.

Mind that SQL Server is susceptible to parameter sniffing.

Upvotes: 1

gbn
gbn

Reputation: 432511

There is no effect at all. I have no proof, because anything about this concentrates on the compilation, statistics, cost optimiser etc...

Also, the parameters would be plugged into a query: any order here would be ignored during the optimisation/compilation process.

Upvotes: 2

Related Questions