April 20, 2010 at 3:25 pm
Roy Ernest (4/20/2010)
CirquedeSQLeil (4/19/2010)
Paul White NZ (4/19/2010)
CirquedeSQLeil (4/19/2010)
I am putting the finishing touches on draft 1 of a new article. Anybody out there willing to give it a review?What's it about?
Simple subject - sp_who2. Hoping it will be worth the read and effort.
I would love to look at it as well... There was a thread here about creating a new version of sp_who2. It was sp_who5 if I am not mistaken and I was also working on it. So this will interest me.
Just looked over sp_who5 (thanks for sending it my way). I noted two things in it that are hitting points in my article - it uses sysprocesses still and also runs dbcc inputbuffer.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
April 20, 2010 at 3:32 pm
Paul White NZ (4/19/2010)
CirquedeSQLeil (4/19/2010)
Simple subject - sp_who2. Hoping it will be worth the read and effort.By the by, are you aware of sp_WhoIsActive?
I use it a lot.
I just finished looking over that proc. Well, I skimmed a lot because I don't have a lot of time to do an in-depth look at ~3800 lines.
I did not a few things, he still uses sysprocesses (I believe it is for the blocking process count), implements a ton of dynamic sql, uses 4 cursors, and has this little bit of code.
SELECT TOP(2147483647) ' + '*,...'
That nugget of code is interesting because I figured he would have been specific about the columns he wanted returned.
Overall a very comprehensive piece of code. I do like the extensive documentation.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
April 20, 2010 at 5:29 pm
Unfortunate score - really.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
April 20, 2010 at 6:01 pm
CirquedeSQLeil (4/20/2010)
I did note a few things, he still uses sysprocesses (I believe it is for the blocking process count), implements a ton of dynamic sql, uses 4 cursors, and has this little bit of code.
SELECT TOP(2147483647) ' + '*,...'
Yep, and all for very good reasons. It is some of the most highly-tuned code I have ever seen.
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
April 20, 2010 at 6:01 pm
CirquedeSQLeil (4/20/2010)
Unfortunate score - really.
:laugh: Though if I remember correctly, the Number of the Beast is 616, not 666...
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
April 20, 2010 at 6:08 pm
Paul White NZ (4/20/2010)
CirquedeSQLeil (4/20/2010)
I did note a few things, he still uses sysprocesses (I believe it is for the blocking process count), implements a ton of dynamic sql, uses 4 cursors, and has this little bit of code.
SELECT TOP(2147483647) ' + '*,...'
Yep, and all for very good reasons. It is some of the most highly-tuned code I have ever seen.
He went to great lengths to ensure proper indexes and statistics were created. I just thought with all of that other effort, he missed a simple select *.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
April 20, 2010 at 6:09 pm
Paul White NZ (4/20/2010)
CirquedeSQLeil (4/20/2010)
Unfortunate score - really.:laugh: Though if I remember correctly, the Number of the Beast is 616, not 666...
That's ok we can assign 6666 to Emperor Paulpatine:-D
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
April 21, 2010 at 2:15 am
Tom.Thomson (4/20/2010)
Gianluca Sartori (4/20/2010)
Thanks, Tom. So, you're a Scot, aren't you?Well, I used to be a Scot. But I got married so now I'm a slave. π
LOL! That's set me up for the day, thanks Tom π
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
April 21, 2010 at 9:08 am
GabyYYZ (4/21/2010)
Please tell me THIS doesn't happen a lot...*groan*.
You have to admit, that completely qualifies as "WTF"
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
April 21, 2010 at 9:08 am
Not by me but based on some of the posters, I wouldn't be surprised!! :w00t:
Although, it is an example of re-usable code, which I'll do whenever possible. It's just not good re-usable code.
-- You can't be late until you show up.
April 21, 2010 at 9:16 am
I've seen even worse things in my app (Visual Basic):
Public const SC AS String = "'" 'Yes, you got it right, it's a single quote
....
' Everywhere in the code at least 1000 times:
sql = "SELECT someField FROM someTable WHERE someField = " & SC & variable & SC
Nice, isn't it?
-- Gianluca Sartori
Viewing 15 posts - 14,611 through 14,625 (of 66,712 total)
You must be logged in to reply to this topic. Login to reply