Compression Flashcards
What are the negatives with compression?
Additional time is spent getting data, so you lose speed with compression.
What does Row Compression do for you?
- Reduces metadata overhead
- Uses variable-length storage for numeric-based types
- Uses variable-length character strings
What is Prefix Compression
Stores commonly-used prefixes elsewhere
Prefix values are replaced by a reference to the prefix
What is Dictionary compression?
Replaces commonly used values. (within a page)
What compression is included with Page Compression?
Row Compression
Prefix Compression
Dictionary Compression
(In order)
What is the t-sql to create compression on a table?
ALTER TABLE [TABLENAME] REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = PAGE)
What is the t-sql to get how much data would be saved with compression?
exec sp_estimate_data_compression_savings
‘schema’,’table’, indexid, null, ‘PAGE’
What is Sparse for a column?
It allows the database to save space with NULL values, but it will use more space with non nulls.
40-60% of values need to be null for this to be effective.
What is a columnstore?
It has a high level of data compression as well as greater speed.
rowstore works better for seeks
columnstore works better for scans (large tables - 200k+ rows)
Table can only have 1 nonclustered columnstore index