Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Timing diff. between Query Analyzer and Profiler

Author  Topic 

sqlbug
Posting Yak Master

201 Posts

Posted - 2014-08-01 : 18:34:30
We are trying to troubleshoot some website performance issues and found some queries taking 2 to 3 seconds when the request comes from the web, and captured by the Profiler.

The same queries, when run in the Query Analyzer take 0 seconds.

What could be the reasons for this difference, I mean why it takes 2 - 3 seconds shown by the Profiler, when it's 0 second in Analyzer?

Any ideas?
Thanks.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-08-01 : 18:37:34
Typically it's due to an execution plan difference. Your SSMS window uses different connection settings than the web site, so you can have a different plan. To mimic the web site, use the same exact connection settings. You can get those settings by looking at the Existing Connections event class.

Otherwise, it's likely due to your session not hitting the same data points due to timing.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

sqlbug
Posting Yak Master

201 Posts

Posted - 2014-08-01 : 19:03:57
So what would be the resolution Tara?
Thanks.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-08-01 : 19:23:36
You need to compare the two execution plans and see what's going on. Perhaps it's a bad plan that can be resolved by updating stats. Perhaps there's bad parameter sniffing.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -