SQL Server: Amazing Sparse Columns an optimized storage for NULL values

This is one of the important article because NULL value is occupying space in the SQL Server.

You can visit, Recently shared one article on NOT NULL vs NULL.

NULL is an Unknown value and it occupies space in SQL Server based on the column data type.

Fixed length Character:
CHAR(3): NULL value occupies 3 bytes.

Integer data type:
int: NULL value occupies 4 bytes.

Variable length data type:
VARCHAR(10): NULL value occupies 2 bytes.

The Sparse Columns:

It is just like any other column, but it reduces the space requirements for the NULL values.

As per the Microsoft’s official document, it saves the space at least up to 20% to 40%.

We can specify SPARSE keyword in the column definition for making SPARSE Column.

Create a table with SPARSE column:

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from dbrnd.com