SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Sparse Columns


Sparse Columns

Author
Message
rajeevkumarramadugu
rajeevkumarramadugu
SSC-Enthusiastic
SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)

Group: General Forum Members
Points: 170 Visits: 246
Comments posted to this topic are about the item Sparse Columns
Lisa Phillip
Lisa Phillip
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2693 Visits: 135
Sparse columns REDUCE the space needed not negates: Sparse columns reduce the space requirements for null values at the cost of more overhead to retrieve nonnull values.
http://msdn.microsoft.com/en-us/library/cc280604.aspx
SQAPro
SQAPro
SSC Veteran
SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)

Group: General Forum Members
Points: 220 Visits: 143
note to self: don't take quizzes till fully caffenated.. could have sworn I was ticking a check box that said "CANNOT have a default value... grumble Angry
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)

Group: General Forum Members
Points: 97001 Visits: 33013
Lisa Phillip (2/20/2009)
Sparse columns REDUCE the space needed not negates: Sparse columns reduce the space requirements for null values at the cost of more overhead to retrieve nonnull values.
http://msdn.microsoft.com/en-us/library/cc280604.aspx


Yep. I got caught by this one too. The answer is incorrect.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Steve Jones
Steve Jones
SSC Guru
SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)SSC Guru (144K reputation)

Group: Administrators
Points: 144246 Visits: 19424
Answers changed, points awarded back.

Sorry

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
rajeevkumarramadugu
rajeevkumarramadugu
SSC-Enthusiastic
SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)

Group: General Forum Members
Points: 170 Visits: 246
I'm sorry for this mistake.
SQAPro
SQAPro
SSC Veteran
SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)

Group: General Forum Members
Points: 220 Visits: 143
There are several sources from MS or MS related that specifically say storing a null takes NO space

http://blogs.technet.com/andrew/archive/2008/02/28/sql-server-2008-sparse-columns.aspx

http://msdn.microsoft.com/en-us/library/cc280604.aspx
Specifically from the link above, a little aways below the 'less space' item quoted in the thread above, you find this (emphasis added)
The SQL Server Database Engine uses the SPARSE keyword in a column definition to optimize the storage of values in that column. Therefore, when the column value is NULL for any row in the table, the values require no storage.


So if you read the details, the 'reduction' for storing null values is apparently 100% 'eliminate' would perhaps have been a more accurate word for them to use than 'reduce', since most of us think of reduce as being less than a 100% modification.. Still since it's proper to speak of 'reducing a price to zero' I believe it's technically grammatically correct to say 'reduce' in that instance, and NOT a conflict to then later in the same document spell out the extent of the reduction being 100%.
OCTom
OCTom
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4115 Visits: 4152
The sparse column itself requires no space for storage if it contains a null value. However, additional storage space is required to store non-null values in the sparse column. That's why you don't get a 100% total space savings. In some cases the savings is pretty low.

http://blogs.technet.com/andrew/archive/2008/02/28/sql-server-2008-sparse-columns.aspx

Please correct me if I'm wrong.

The weekend is here... nice. Cool
SQAPro
SQAPro
SSC Veteran
SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)SSC Veteran (220 reputation)

Group: General Forum Members
Points: 220 Visits: 143
skjoldtc (2/20/2009)
The sparse column itself requires no space for storage if it contains a null value. However, additional storage space is required to store non-null values in the sparse column. That's why you don't get a 100% total space savings. In some cases the savings is pretty low.

http://blogs.technet.com/andrew/archive/2008/02/28/sql-server-2008-sparse-columns.aspx

Please correct me if I'm wrong.

The weekend is here... nice. Cool


That's exactly as I understand it. The books-online stuff actually gives the approximate level of 'sparseness' (as it were) needed to achieve a 40% space savings.. So yeah a 'sparse' column that isn't actually sparsely populated with cells that contain non-null values, could very easily use more space.

I think the question however was as to the tickbox for the item that said that storing a null in a sparse column uses zero space, which based on the docs referenced above is TRUE
Tom Thomson
Tom Thomson
One Orange Chip
One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)

Group: General Forum Members
Points: 25743 Visits: 12494
SQAPro (2/20/2009)
note to self: don't take quizzes till fully caffenated.. could have sworn I was ticking a check box that said "CANNOT have a default value... grumble Angry

Me too - must be something in the beer.

Tom

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search