Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Performance switched with parameter
Message
De
23/09/2014 15:22:22
 
 
À
23/09/2014 14:11:33
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Indexation
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Web
Divers
Thread ID:
01607903
Message ID:
01608109
Vues:
48
>Kevin mentioned about the design of what the execution plan shows. It is exactly as he says. If it mostly a bunch of Compute Scalar and Constant Scan. Their cost is at 0%. So, I am not sure if this is really a factor.
>
>In both cases, it does take my index. So, I am not sure if it just a question a nanosecond of difference or much significative.

Michel, if you're getting the same performance and the same usage of the index, and the only difference is a paired set of compute scalar/constant scans for each variable in the execution plan, then I can say with confidence that the difference is insignificant.

Again, when you use variables instead of literals in the WHERE clause (and I'm not even talking about parameters, just plain variables), SQL Server has to take an extra tiny step to evaluate the variables and then create an internal "constant row".

The execution plan might really "look wonky" compared to using literals, especially if you have many variables - but because the total cost of all those additional operators is so small relative to the entire query cost, it's nothing to be concerned about. It's simply the way SQL Server works.

This is a different situation than the RECOMPILE option that you and Walter talked about - that's when you have things like parameter sniffing, or when you've done things like:
WHERE CustomerAccount = @CustomerAccount OR CustomerAccount IS NULL.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform