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?