G
Guest
All,
I have an SP that takes about 5 seconds to run before any caching performed by SQL server (I run DBCC DROPCLEANBUFFERS to make sure in my tests).
When I hook the SP into a SqlCommand object, the SP Cmd.ExecuteReader line takes about 5 seconds every time I reload the page. But if I run it through Query Analyzer it takes 5 seconds for the first run and every subsequent request is less than half a second. I assume this is behavior of Sql Server caching the tables/results.
My question is why would Cmd.ExecuteReader take 5 seconds each time if Sql Server is indeed caching teh tables/results (as evidenced by the fast subsequent QA calls)? It is possible there is SET environment variable being called by SqlCommand, or a lack of variable in the connection string that causes the ExecuteReader to take so long each time?
Thanks,
JL
I have an SP that takes about 5 seconds to run before any caching performed by SQL server (I run DBCC DROPCLEANBUFFERS to make sure in my tests).
When I hook the SP into a SqlCommand object, the SP Cmd.ExecuteReader line takes about 5 seconds every time I reload the page. But if I run it through Query Analyzer it takes 5 seconds for the first run and every subsequent request is less than half a second. I assume this is behavior of Sql Server caching the tables/results.
My question is why would Cmd.ExecuteReader take 5 seconds each time if Sql Server is indeed caching teh tables/results (as evidenced by the fast subsequent QA calls)? It is possible there is SET environment variable being called by SqlCommand, or a lack of variable in the connection string that causes the ExecuteReader to take so long each time?
Thanks,
JL