To Store XML or To Not Store XML

In SQL Server 2005, XML was a new data type introduced in order to store XML documents and fragments in a SQL Server database. While this data type is most definitely useful, one of the main questions that you need to ask yourself before using it is "Should I store this data as XML?"
Based on what data should be stored and/or the processing that the data will participate in later, the shredding the XML data to store the data in a relational form (if it is possible) may be the better than storing it as XML to avoid possible storage and performance issues in the future. If the data is going to be used as XML for later processing then storing it as XML is beneficial to avoid extra processing once you consider the cost for storage as being minimal compared to the processing cost. If you are unsure of when or why to use the XML data type then I suggest you read Tim Anderson's interview with Dr Micheal Rys which highlights the thinking behind some features that were introduced and provides some guidance on how to use them. Please note that this article is based on SQL Server 2005, new and improved XML features for SQL Server 2008 will appear in a later post.

0 comments:

Community Links