SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Page level compression - Indices/Partitions/Heap


Page level compression - Indices/Partitions/Heap

Author
Message
curious_sqldba
curious_sqldba
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2900 Visits: 3636
I have read a lot of articles on compression but i couldn't find a definitive answer for these:

i) if a table has no clustered index and has non-clustered indices, do i need to compress the table first and then the nc indices?


ii)if a table has clustered index and has non-clustered indices, would just compressing the clustered index also compress the nc index?

iii) When compressing the clustered index, can this be with ONLINE=ON option?
jasona.work
jasona.work
SSCarpal Tunnel
SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)

Group: General Forum Members
Points: 4002 Visits: 11728
Having just dealt with compressing a table with both clustered and non-clustered indexes:

i) I don't believe so. I believe you can compress just the indexes, but you probably won't gain much savings there.

ii) No.

iii) I believe it is. I can't say for sure, my job that did the compression of the clustered index doesn't have an "online=on" set, but I also did it during off-hours so I wouldn't affect the users...

Jason
GilaMonster
GilaMonster
SSC Guru
SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)

Group: General Forum Members
Points: 86628 Visits: 45251
curious_sqldba (7/23/2013)
i) if a table has no clustered index and has non-clustered indices, do i need to compress the table first and then the nc indices?


Depends. Do you want the table and the nonclustered indexes compressed? If so, you have to compress the table and the nonclustered indexes. Order is irrelevant, but to be honest it's probably fastest to disable the nonclustered indexes, compress the table then rebuild the nonclustered indexes with compression. Otherwise they all get rebuilt twice.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Elliott Whitlow
Elliott Whitlow
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10024 Visits: 5314
As a side point, isn't compression limited to Enterprise Edition..

CEWII
curious_sqldba
curious_sqldba
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2900 Visits: 3636
GilaMonster (7/23/2013)
curious_sqldba (7/23/2013)
i) if a table has no clustered index and has non-clustered indices, do i need to compress the table first and then the nc indices?


Depends. Do you want the table and the nonclustered indexes compressed? If so, you have to compress the table and the nonclustered indexes. Order is irrelevant, but to be honest it's probably fastest to disable the nonclustered indexes, compress the table then rebuild the nonclustered indexes with compression. Otherwise they all get rebuilt twice.


Thanks. How about this one?

ii)if a table has clustered index and has non-clustered indices, would just compressing the clustered index also compress the nc index?
jasona.work
jasona.work
SSCarpal Tunnel
SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)

Group: General Forum Members
Points: 4002 Visits: 11728
Nope. You still would need to (if you deem it worth the time and effort) go back and compress the non-clustered indexes.
SQLCharger
SQLCharger
SSC Veteran
SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)

Group: General Forum Members
Points: 256 Visits: 1420
Best is to run the compression estimation on each structure and then decide which ones are worth row-compressing, which ones page-compressing, and which ones are best left alone.

If page compression only gives you 30% space savings, it is probably not a good idea, but if it gives you 80% savings, then it might be worth considering (still not certain, if it is updated frequently it may still be worth leaving alone - it depends!)

Cheers,

JohnA

MCM: SQL2008
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search