Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12345»»»

Query Plan Execution Order Expand / Collapse
Author
Message
Posted Thursday, October 27, 2011 3:15 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 4:31 AM
Points: 1,150, Visits: 1,089
Great question for learning - cheers

And, more importantly, congrats on winning the Webb Ellis, SQL Kiwi!
Post #1196789
Posted Thursday, October 27, 2011 3:53 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 11:15 AM
Points: 3,964, Visits: 5,204
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”
Post #1196799
Posted Thursday, October 27, 2011 4:59 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 1:36 PM
Points: 6,002, Visits: 8,267
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
Post #1196825
Posted Thursday, October 27, 2011 5:38 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Sunday, April 27, 2014 7:45 PM
Points: 1,589, Visits: 253
Tough question with good references. I missed it but I learned something today.

http://brittcluff.blogspot.com/
Post #1196836
Posted Thursday, October 27, 2011 5:54 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Saturday, August 30, 2014 9:14 AM
Points: 1,258, Visits: 13,554
really, it's a very good question!!!

thanks Paul!!



rfr.ferrari
DBA - SQL Server 2008
MCITP | MCTS

remember is live or suffer twice!
Post #1196843
Posted Thursday, October 27, 2011 6:27 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 10:35 AM
Points: 1,825, Visits: 2,175
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
Post #1196864
Posted Thursday, October 27, 2011 6:47 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Wednesday, September 17, 2014 2:30 AM
Points: 1,872, Visits: 3,454
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.
Post #1196879
Posted Thursday, October 27, 2011 7:11 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, November 8, 2011 7:12 AM
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.
Post #1196889
Posted Thursday, October 27, 2011 7:28 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 3:29 PM
Points: 5,046, Visits: 10,571
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

Get your two-cent-answer quickly
spaghettidba.com
@spaghettidba
Post #1196906
Posted Thursday, October 27, 2011 7:30 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, September 16, 2014 7:35 AM
Points: 2,819, Visits: 2,563
Tough question. Good learning opportunity. Thanks Paul.
Post #1196908
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse