XML vs ntext

  • The pros with using xml data type:

    -Storage is usually reduced, and my guess is that this causes less usage of buffer cache, but I haven't testet the last one. Keep in mind that the internal representation uses more space versus varchar for small xml document.

    -You get built in validation that the xml document is valid xml. You can even validate it based on an xsd schema.

    -Lot of built in function to query and manipulate the xml document with T-SQL. You can of course do this with a xml document stored in a varchar column too, but that requires extra CPU to convert it to XML.

    -You can create indexes on the xml documents for faster querying.

    Cons:

    - Extra CPU overhead when storing and reading xml due to conversion to and from the internal format. But when I run tests this depends on the size of the xml document.

    You need to run your own test on real data in your system to see how CPU and disk I/O and buffer cache is influenced by using xml vs varchar.

Viewing post 16 (of 15 total)

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