What does MSSQL execution plan show?

Posted by tim on Stack Overflow See other posts from Stack Overflow or by tim
Published on 2010-06-03T17:22:10Z Indexed on 2010/06/03 17:24 UTC
Read the original article Hit count: 341

There is the following code:

declare @XmlData xml =
'<Locations>
<Location rid="1"/>
</Locations>'

declare @LocationList table (RID char(32));
insert into @LocationList(RID)
select Location.RID.value('@rid','CHAR(32)') 
from @XmlData.nodes('/Locations/Location') Location(RID)

insert into @LocationList(RID)
select A2RID from tblCdbA2

Table tblCdbA2 has 172810 rows.

I have executed the batch in SSMS with “Include Actual execution plan “ and having Profiler running.

The plan shows that the first query cost is 88% relative to the batch and the second is 12%, but the profiler says that durations of the first and second query are 17ms and 210 ms respectively, the overall time is 229, which is not 12 and 88.. What is going on? Is there a way how I can determine in the execution plan which is the slowest part of the query?

© Stack Overflow or respective owner

Related posts about sql-server-2008

Related posts about sql-execution-plan