What is the performance penalty of XML data type in SQL Server when compared to NVARCHAR(MAX)?

Posted by Piotr Owsiak on Stack Overflow See other posts from Stack Overflow or by Piotr Owsiak
Published on 2010-05-21T15:32:52Z Indexed on 2010/05/21 15:50 UTC
Read the original article Hit count: 315

Filed under:
|
|

I have a DB that is going to keep log entries.
One of the columns in the log table contains serialized (to XML) objects and a guy on my team proposed to go with XML data type rather than NVARCHAR(MAX). This table will have logs kept "forever" (archiving some very old entries may be considered in the future). I'm a little worried about the CPU overhead, but I'm even more worried that DB can grow faster (FoxyBOA from the referenced question got 70% bigger DB when using XML).

I have read this question http://stackoverflow.com/questions/514827/microsoft-sql-server-2005-2008-xml-vs-text-varchar-data-type and it gave me some ideas but I am particulairly interrested in clarification on whether the DB size increases or decreases.

Can you please share your insight/experiences in that matter.

BTW. I don't currently have any need to depend on XML features within SQL Server (there's nearly zero advantage to me in the specific case). Ocasionally log entries will be extracted, but I prefer to handle the XML using .NET (either by writing a small client or using a function defined in a .NET assembly).

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about Xml