Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 what's order of operations in query exec. plan ?

Author  Topic 

rw30
Starting Member

3 Posts

Posted - 2009-09-24 : 16:53:27
I thought that the operation with highest NodeID is the first one, then every next step got the NodeID decremented by 1.
Now, after I used the option (force order) hint it looks I was wrong

my query is:

select *
into tmp_tab
from
assoc_fac1_fac2
inner join fac1 on
assoc_fac1_fac2.fac1_key = fac1.fac1_key
inner join
dim1 on fac1.dim1_key = dim1.dim1_key
option (force order);

query plan :

[URL=http://img38.imageshack.us/i/planforceorder.jpg/][/URL]

where:
table scan of assoc_fac1_fac2 has nodeID=4
table scan of fac1 has nodeID=5
table scan of dim1 has nodeID=7

so is there any correlation between nodeID value and order of the operations taken during executing the query or not ?

if no, how can be the order of operations read from XML plan ? or should I just use text plan for determining order ?

regards,

rw30

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-09-24 : 17:13:12
quote:
so is there any correlation between nodeID value and order of the operations taken during executing the query or not
I don't know if there is, but if I can ask, why is that important? The optimizer processes the query on a cost basis, and will try to minimize it (choose the plan with minimum cost). I can understand if you're comparing the plans generated by using various hints, but whether each node on the plan is actually executed in that order doesn't seem as relevant.
Go to Top of Page
   

- Advertisement -