Situation
- Data warehouse on Sql Server 2008 Enterprise
- 36+ million row heap (don't ask), with 60+ columns
- 750k added monthly
- No primary key defined (I have now identified one)
- No compression
What I'm thinking of doing (in this order)
- Add page level compression
- Add the PK
- Add a number of non-clustered indexes
- Do this as quickly as possible
Question
- Ultimately: Do I add the PK or the page compression first? (Does it matter?)
- If I add the compression first to the table, will any indexes then inherit the table level compression settings? The answer to this particular question is "No, compression is not inherited", found here on dba.stackexchange
What I'm leaning towards at the moment
-- Add page level compression
alter table dbo.TableName
rebuild with (data_compression = page)
;
go
-- Add primary key
alter table dbo.TableName
add constraint PK_TableName
primary key clustered (<Columns>)
;
go
-- Add NC_IXs here
...
...
Ive looked here (PK creation documentation) and here (ALTER TABLE documentation), but can't see anything definitive about whether or not any indexes inherit table compression settings. The answer to this particular question is "No, compression is not inherited", found here on dba.stackexchange