Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Optimization with a date condition
Message
From
22/03/2011 17:33:52
 
General information
Forum:
Microsoft SQL Server
Category:
Scripting
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01504587
Message ID:
01504595
Views:
41
>Try adding
>
>option (recompile) to the query.
>
>http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/a2030652-800b-48dd-8857-5e6e60658a6e
>
>http://social.msdn.microsoft.com/forums/en-us/transactsql/thread/CFA976DB-2D12-4D80-B4B2-CEFFB80B7F6C

At the same time, I was testing something else. The fact that I have 175 fields to extract was causing this. So, when I subselected to get the primary key first and join that into the main table for the result, it was instant. Then, when I tried the original syntax with the RECOMPILE option, it was then also instant.

Now, which approach is better recommanded. Should I go with the subselect to get the primary key and then join that into the main table or to simply use the RECOMPILE? In the Web site applications, I have it off. But, in this particular script that is executed in SSMS, I could consider it if it would be judged as a better approach.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform