This question already has answers here:
OPTION (RECOMPILE) is Always Faster; Why? (6 answers)
Closed 12 days ago.
I have an application that uses a T-SQL query and queries SQL Server. I just wanted to know if 2 users from 2 different machines running the application, does the SQL Server cache the results after the first user runs the application? And if so, where does the cache happen? Does it happen on the host server where the SQL Server is installed on? Or on the machine, that application is installed on?
My problem is that I have a query that runs very fast in SQL Server Management Studio, but is very slow when it gets called from the application.
Thank you!
1条答案
按热度按时间nkoocmlb1#
A long-shot suggestion for you. Change the query in your application to end with
OPTION(RECOMPILE)
. It may be that SQL server is hanging on to a no-longer-optimal execution plan. Worth a try.