Sparse columns are ordinary columns that have an optimized storage for null values. Sparse columns reduce the space requirements for null values at the cost of more overhead to retrieve nonnull values. Consider using sparse columns when the space saved is at least 20 percent to 40 percent. 

CREATE TABLE [dbo].[tblTable01]
(
[Id] [bigint] NOT NULL,
[Col01] [tinyint] SPARSE NULL,
[Col02] [datetime] SPARSE NULL,
)
GO

Sources:

https://docs.microsoft.com/en-us/sql/relational-databases/tables/use-sparse-columns?view=sql-server-ver15

Last modified: January 10, 2020

Author

Comments

Write a Reply or Comment