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


Query Plan Execution Order


Query Plan Execution Order

Author
Message
Michael Lysons
Michael Lysons
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2233 Visits: 1453
Great question for learning - cheers :-)

And, more importantly, congrats on winning the Webb Ellis, SQL Kiwi!
Stewart "Arturius" Campbell
Stewart "Arturius" Campbell
SSCoach
SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)

Group: General Forum Members
Points: 17365 Visits: 7421
Good question - got it wrong, but learned a great deal from it.
Thanks, Paul.

____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Hugo Kornelis
Hugo Kornelis
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19011 Visits: 12426
Good question, Paul!

I had the correct answer,but only thanks to the fact that I attended SQL Saturday in Portland a few weeks back (just before the PASS Summit). I don't recall who said it, probably either Buck or Rob, but the quote itself will always stick: "Exection plans suck". Refering to the little-known fact that data is not pushed from right to left (as most people usually read plans, myself included), but pulled ("sucked") by the top-left operator from the operator to the right and below it.


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Britt Cluff
Britt Cluff
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2391 Visits: 253
Tough question with good references. I missed it but I learned something today.

http://brittcluff.blogspot.com/
rfr.ferrari
rfr.ferrari
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2181 Visits: 13639
really, it's a very good question!!!

thanks Paul!!


rfr.ferrari
DBA - SQL Server 2008
MCITP | MCTS

remember is live or suffer twice!
the period you fastest growing is the most difficult period of your life!

Thomas Abraham
Thomas Abraham
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3861 Visits: 2256
tommyh (10/27/2011)
Yes the stream aggregate gets called first... but it hasnt finished. So is the important part which gets called first or which gets finished first? Personally i think its the part that gets finished first thats important (or more precisly the thing that performs its purpose first). I cant say a function has been executed when it hasnt actually done anything.


Got it wrong because I just parroted something I picked up from this site. Moving a little fast this morning.

However, while I have no quibble with the explanation, I think I prefer Tommy's point of view semantically. I tend to think of "Execute" in terms of completion. The example that came to mind was a recursive call. Although the first call starts "executing" first, it can't complete its business until all subsequent calls have completed.

Thanks to SQL Kiwi for the question.

Please don't go. The drones need you. They look up to you.
Connect to me on LinkedIn
Nils Gustav Stråbø
Nils Gustav Stråbø
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3703 Visits: 3575
Hugo Kornelis (10/27/2011)
"Exection plans suck". Refering to the little-known fact that data is not pushed from right to left (as most people usually read plans, myself included), but pulled ("sucked") by the top-left operator from the operator to the right and below it.
Excellent explanation Hugo :-)
Oh, and I got the question wrong. :-P
ksummerlin-532910
ksummerlin-532910
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 27
tommyh (10/27/2011)


Yes the stream aggregate gets called first... but it hasnt finished. So is the important part which gets called first or which gets finished first? Personally i think its the part that gets finished first thats important (or more precisly the thing that performs its purpose first). I cant say a function has been executed when it hasnt actually done anything.

Could be a language thing though that i put a different meaning into "executes" then everyone else :-)

/T




I agree with tommy on this one. The question is a bit flawed. If you are attempting to teach the reader that the plan started with the left-most operation, then ask that in the question. Otherwise, you are attempting to bait the reader (unintentionally of course) into choosing the meaning of 'executes first'.

Nonetheless, the links are great ones to read and understand.
Gianluca Sartori
Gianluca Sartori
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24505 Visits: 13362
ksummerlin-532910 (10/27/2011)
tommyh (10/27/2011)


Yes the stream aggregate gets called first... but it hasnt finished. So is the important part which gets called first or which gets finished first? Personally i think its the part that gets finished first thats important (or more precisly the thing that performs its purpose first). I cant say a function has been executed when it hasnt actually done anything.

Could be a language thing though that i put a different meaning into "executes" then everyone else :-)

/T




I agree with tommy on this one. The question is a bit flawed. If you are attempting to teach the reader that the plan started with the left-most operation, then ask that in the question. Otherwise, you are attempting to bait the reader (unintentionally of course) into choosing the meaning of 'executes first'.

Nonetheless, the links are great ones to read and understand.


Although I got it wrong, I disagree with you.

In this code, what executes first?


function main(){
return sayHello() + " " + sayWorld()
}

function sayHello(){
return "Hello"
}

function sayWorld(){
return "World"
}



I think it's not hard at all to identify the function that executes first in this pseudo-code fragment.
I'm sure that Paul wants us to get away with this concept.

--Gianluca Sartori

How to post T-SQL questions
spaghettidba.com
@spaghettidba
Daniel Bowlin
Daniel Bowlin
SSCrazy Eights
SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)

Group: General Forum Members
Points: 8136 Visits: 2629
Tough question. Good learning opportunity. Thanks Paul.
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