Create an Index on a Partition Table using Page and Row Compression in SQL Server 2008

SQL Server 2008 provides an index option which has the ability to compress the contents of the index based on the row or the page. Here’s the syntax for doing it.

I assume that you have already created a Partition Table

-- DATA_COMPRESSION = ROW
CREATE CLUSTERED INDEX IX_RowCompr
ON YourPartitionTable (ColumnA)
WITH ( DATA_COMPRESSION = ROW ) ;
GO

-- DATA_COMPRESSION = PAGE
CREATE CLUSTERED INDEX IX_PageCompr
ON YourPartitionTable (ColumnA)
WITH ( DATA_COMPRESSION = PAGE ) ;
GO

-- DATA_COMPRESSION = ROW/PAGE
CREATE CLUSTERED INDEX IX_PageRowCompr
ON YourPartitionTable (ColumnA)
WITH (DATA_COMPRESSION = PAGE ON PARTITIONS(1 To 3),
DATA_COMPRESSION = ROW ON PARTITIONS (4) ) ;
GO

Additional Reading

Here are are some useful articles on Page and Row Compression I read recently

Creating Compressed Tables and Indexes

Page compression in SQL Server 2008

Row compression in SQL Server 2008

1 comment:

  1. nice post, really have informative information, thanks for publishing this post.

    ReplyDelete