Previously I wrote about SQL SERVER – 2008 – Introduction to SPARSE Columns. Let us understand the concept of SPARSE column in more detail. I suggest you read the first part before continuing reading this article.
All SPARSE columns are stored as one XML column in database. Let us see some of the advantage and disadvantage of SPARSE column.
Advantages of SPARSE column are:
- INSERT, UPDATE, and DELETE statements can reference the sparse columns by name. SPARSE column can work as one XML column as well.
- SPARSE column can take advantage of filtered Indexes, where data are filled in the row.
- SPARSE column saves lots of database space when there are zero or null values in database.
Disadvantages of SPARSE column are:
- SPARSE column does not have IDENTITY or ROWGUIDCOL property.
- SPARSE column can not be applied on text, ntext, image, timestamp, geometry, geography or user defined datatypes.
- SPARSE column can not have default value or rule or computed column.
- Clustered index or a unique primary key index can not be applied SPARSE column. SPARSE column can not be part of clustered index key.
- Table containing SPARSE column can have maximum size of 8018 bytes instead of regular 8060 bytes.
- A table operation which involves SPARSE column takes performance hit over regular column.
Let me know your thoughts about SPARSE column feature of SQL Server 2008, I am very eager to see your point of view on this new feature.
Reference : Pinal Dave (https://blog.sqlauthority.com)