March 23, 2010

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


Did you like this post?
kick it on DotNetKicks.com
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

 
  Feedback:

comments

1 Response to "Create an Index on a Partition Table using Page and Row Compression in SQL Server 2008"
  1. Robert Julius said...
    April 27, 2010 at 3:04 AM

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

 

Copyright © 2009-2014 All Rights Reserved for SQLServerCurry.com by Suprotim Agarwal | Terms and Conditions