sql server 2008 - Passing XML vs Passing User Defined Type -
i working enhancing performance on old stored procedure. it's getting single node xml parameter passed stored procedure. xml used in cross apply. i'm wondering if x-query in cross appy pulling out value row row, or if parsed beforehand. less overhead me pass list udt instead of xml
this code generates xml
select @newrunbatchprocesssteps = ( select tracking.newprimarykey runbatchprocessstepid @runbatchprocessstep runbatchprocessstep inner join @runbatchprocessnew tracking on runbatchprocessstep.runbatchprocessstepid = tracking.oldprimarykey xml path('runbatchprocessstep'), root ('runbatchprocesssteps') )
here's how it's used.
select somefields runbatchprocessstep cross apply @newrunbatchprocesssteps.nodes('/runbatchprocesssteps/runbatchprocessstep') runbatchprocessstepsxml(ref) inner join batchprocessstep btp on runbatchprocessstep.batchprocessstepid = btp.batchprocessstepid inner join module m on m.modulecode = btp.modulecode runbatchprocessstep.runbatchprocessstepid = ref.value('runbatchprocessstepid[1]', 'int')
if take @newrunbatchprocesssteps , turn single column udt , inner join it, should see performance improvement?
it's based on data count. if pass more number of data means, can use udt otherwise can use xml. because xml parsing takes more time when pass more no.of data. it's based on requirement.
Comments
Post a Comment