Row Compression in SQL Server
In this post we will learn about Row Compression in SQL Server. How to implement Row Compression in SQL Server and benefits of it.
Row compression, is not a complicated process. Basically, it identifies the data type
of each columns, converts it to variable length, and finally reduces the amount of required storage to only what is needed. As a result, compression increases the amount of data that can be stored on a page. In addition, it may reduce the amount of metadata associated with a record.
Compress a table using SSMS:
1. Open SQL Server management studio.
2. Expand Server node > Databases > Database > Table.
3. Right click on table which you want to compress, and click on storage > manage compression.
4. When the Data Compression Wizard appears, check the box labeled Do Not Show This Starting Page Again, and click Next.
5. Check the checkbox labeled Use Same Compression Type for All Partitions.
6. Select Row from the drop-down list, and click Calculated in the bottom-right corner.
7. Click Next, next window gives you options like when and how you want to compress the data.
8. Click on Finish.
Row Compression with T-SQL:
USE [Lab] ALTER TABLE [dbo].[Gridviewimage] REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = ROW )