Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Performance switched with parameter
Message
From
20/09/2014 19:54:55
Walter Meester
HoogkarspelNetherlands
 
 
To
20/09/2014 14:17:12
General information
Forum:
Microsoft SQL Server
Category:
Indexing
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01607903
Message ID:
01607910
Views:
60
>>The optimizer is not always able to optimize a query in the optimal way if you set the parameters in the script. Usually this does go ok when using parameterized Queries.
>>
>>Perhaps eliminating the OR with IN() resolves the problem
>
>Thanks for the suggestion but this was tested an hour ago with same result.

ok, let me ask the question. Why are you setting the values in the script? Can't you set the values through parameters (instead of using variables)? SQL server is able to do parameter sniffing and use that to optimize the plan.

If you have to do it through a script it might be an idea to use the sp_executesql stored procedure which in itself will start another optimization round.

Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform