Using XML data as parameter in Stored Procedure

  • Hi,

    I heard using XML data as parameter will hurt the performance of T-SQL? Is that true?

    For me, using XML data as parameter, will get rid of looping at business-tier.

    Need explanation

  • I wouldn’t say that using XML parameter should hurt performance. As in many other things, I would say that it depends. If XML parameter would be something that only hurts performance, then most chances are that it wouldn’t be supported. Now if you are talking about the possibility that sometimes it is better to use a different data type, then I would agree to that. Each datatype and technique has a place that it helps and a place that it doesn’t.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • To give an example of Adi's great explanation regarding the right place for the right tool:

    If you'd need to send 3 or 4 parameter to a procedure, then a comma separated list would perform better than the XML solution.

    But if you'd need to send a larger array to a proc and don't us SS2K8, the in most cases XML is the way to go.

    So, to second Adi: It depends. 🙂



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Ok guys. Felt better now.

    For me, XML parameter will hurt performance it's a myth

  • miss.delinda (3/3/2010)


    Ok guys. Felt better now.

    For me, XML parameter will hurt performance it's a myth

    No it's not. And yes, it is.

    Like with any other tool/command/feature: if used wrong, it will hurt performance. If used correctly, the overhead caused by the xml structure will be minor.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply