SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Identifying Queries Running Slower Than Normal


Identifying Queries Running Slower Than Normal

Author
Message
Andy Holliday
Andy Holliday
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 37
I had to add

END
GO

to the end of the code too. It appears to be missing on the web page.
Steve Jones
Steve Jones
SSC Guru
SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)

Group: Administrators
Points: 62134 Visits: 19102
END added to the code.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
ianstirk
ianstirk
SSC-Enthusiastic
SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)

Group: General Forum Members
Points: 174 Visits: 1037
Hi,

from the feedback, I’m not sure if people have understood this article completely.

The article discusses how to identify queries that are running slower than normal i.e. ones that seem to have degraded in performance. It is not about finding slow queries per se.

If you want to discover which queries are taking the longest to run (in terms of duration or IO), look at the sections entitled “Costly Queries by CPU”, and “Costly Queries by I/O”, in my MSDN article here: http://msdn.microsoft.com/en-us/magazine/cc135978.aspx

Thanks
Ian
John Mitchell-245523
John Mitchell-245523
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14061 Visits: 15950
Good article, Ian. Ignore those ignorant enough to criticise without giving a reason. And to those who carp about bugs in the code, I say this: Debug it yourself! You'll learn by doing this. Incorrect syntax? Use Books Online to find out what the correct syntax is. Divide by zero error? Put in your own CASE statement to stop this. Carriage returns lost when copying and pasting? Put them back in. Honestly, whenever I post code I'm half tempted to put deliberate errors in it so that people don't just copy it and use it without thinking about it.

John
nick-889921
nick-889921
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 3
I created the proc and executed it. Got the following:

Msg 8134, Level 16, State 1, Procedure dba_QueryTimeDelta, Line 25
Divide by zero error encountered.
The statement has been terminated.

(0 row(s) affected)

(0 row(s) affected)

Any quick fixes available?
Nick
Troy Gatchell-386101
Troy Gatchell-386101
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 38
For a SQL 2000 tool google sp_who_3 written by Mike Barzilli.
BuckWoody
BuckWoody
Old Hand
Old Hand (311 reputation)Old Hand (311 reputation)Old Hand (311 reputation)Old Hand (311 reputation)Old Hand (311 reputation)Old Hand (311 reputation)Old Hand (311 reputation)Old Hand (311 reputation)

Group: General Forum Members
Points: 311 Visits: 70
Same here. I've ensured that the code pasted correctly, there are no bad characters and so on. But I'm also getting a divide by zero error - I'm assuming this in the first CASE statement, but I don't have time to debug that right now. Interesting concept, though.


Buck Woody
MCDBA, MCSE, Novell and Sun Certified
ianstirk
ianstirk
SSC-Enthusiastic
SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)

Group: General Forum Members
Points: 174 Visits: 1037
Hi,

please see a previous discussion entry by jacroberts, he has the relevant code to prevent the divide by zero error.

thanks
Ian
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search