June 22, 2009 at 5:26 am
Surprisingly enough, a Cursor would probably be faster than the Triangular Join method of doing the running totals that Carl currently has deployed. Right now, the running total calc he does generates more than 4 million internal rows on one leg of the execution plan.
On my poor ol' 7 year old single CPU box, Carl's code has a best time of 44 seconds. I've got it down to just 15 seconds without doing any optimizations on his code... just replaced the running total logic on the 80k table. If you do the simple math, I've already got his 13 seconds down to just over 4 on his box and, like I said, I've made no optimizations to his logic.
I've gotta get ready and scoot to work... that'll give the pork chops and the jar of apple sauce Paul gave me time to freeze up good and solid. 😛
--Jeff Moden
Change is inevitable... Change for the better is not.
June 22, 2009 at 6:30 am
ps (6/20/2009)
Paul White (6/20/2009)
ps (6/20/2009)
Well it looks as if someone's put his exam question papers here to be solved ..:-Dhttp://www.sqlservercentral.com/Forums/Topic738841-146-1.aspx
It took an enormous effort of will on my part not to post sarcastic and/or deliberately wrong answers.
Sigh.
ummm.. i think we need to give him fair amount of chance to prove that he's willing to learn. He can obviously fast track his learnings here.[/quote]
Learning is one thing. Giving answers that inhibit research on the OP's part is another. There are many avenues to learn and many others to allow shortcuts. Long range growth is to first attempt to do for yourself and then to seek help. Google and BOL can be your best friends and sites like this are simply great supplements in the process - IMO.
-- You can't be late until you show up.
June 22, 2009 at 9:57 am
Anyone want to take a stab at 800+ lines of cursor-ridden, mostly uncommented code?
http://www.sqlservercentral.com/Forums/FindPost739170.aspx
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 22, 2009 at 10:06 am
Oh, lordy. That's too much like work. After about the third SELECT DISTINCT, I lost interest. Sorry.
"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
June 22, 2009 at 10:11 am
GilaMonster (6/22/2009)
Anyone want to take a stab at 800+ lines of cursor-ridden, mostly uncommented code?
I'll take the fact of less points on my side than him as an excuse to step back. Waaayyyyy back....
June 22, 2009 at 10:19 am
Grant Fritchey (6/22/2009)
Oh, lordy. That's too much like work. After about the third SELECT DISTINCT, I lost interest.
There are three select DISTINCT in there? I didn't even look that far, just scanned for the first cursor, hauled it out and posted it.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 22, 2009 at 10:20 am
I have to agree whole heartly with Grant on this one. I'd want to get paid to work on that one. Lot of code, not a lot of comments on what is going on. This one could take quite a bit of time that could be put to much better use helping others, or spending time with family and friends (or better yetjust doing my own work).
June 22, 2009 at 10:23 am
Actually, if I did the search correctly, I found 5 SELECT DISTINCT statements in the code.
Edit:
And 3 cursors.
June 22, 2009 at 12:18 pm
Jeff Moden (6/22/2009)
Does anyone have some apple-sauce? 😛
Strangely enough, I just picked some up last night...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 22, 2009 at 1:29 pm
I hope I didn't scare away the newbie on this thread with my Tally table joke... But I HAD to do it... :hehe:
June 22, 2009 at 3:02 pm
June 22, 2009 at 3:10 pm
Jeff Moden (6/22/2009)
Surprisingly enough, a Cursor would probably be faster than the Triangular Join method of doing the running totals that Carl currently has deployed.
Not the way I would write it 😉
Fair point though. 🙂
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
June 22, 2009 at 3:12 pm
GilaMonster (6/22/2009)
Anyone want to take a stab at 800+ lines of cursor-ridden, mostly uncommented code?
Working on it now. :w00t:
Was easier than looking at This One
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
June 22, 2009 at 3:17 pm
Florian Reischl (6/22/2009)
Payment for solutions on a forum? Sounds like experts-exchange 😛
Who paid for an expert sex change?
Or did I misread that?
😀
Florian Reischl (6/22/2009)
@Jeff: I beat it once in the split thread. Do I get it for free or do I have to pay twice? 😀
Ahem.
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
June 22, 2009 at 3:20 pm
tosscrosby (6/22/2009)
ummm.. i think we need to give him fair amount of chance to prove that he's willing to learn.
Not for me. They were most likely interview or homework questions posted verbatim. YMMV but I chose not to post (though tempted to, as I said before).
I agree with the broad sentiments in your post however.
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
Viewing 15 posts - 5,941 through 5,955 (of 66,712 total)
You must be logged in to reply to this topic. Login to reply