question

techresearch7777777-7743 avatar image
0 Votes"
techresearch7777777-7743 asked techresearch7777777-7743 answered

Compress Indexes

Hello, is it correct to say if I compress a Table as example:

ALTER TABLE [dbo].[Table_Items] REBUILD WITH (DATA_COMPRESSION=PAGE);

Afterwards I don't need to run compress script for it's Clustered Index since the Clustered Index is the table?

If yes, can anyone provide script to compress all Nonclustered Indexes within a SQL 2016 user DB (excluding Clustered Indexes if above is correct)?

Thanks in advance.

sql-server-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ErlandSommarskog avatar image
0 Votes"
ErlandSommarskog answered

Afterwards I don't need to run compress script for it's Clustered Index since the Clustered Index is the table?

Yes.

If yes, can anyone provide script to compress all Nonclustered Indexes within a SQL 2016 user DB (excluding Clustered Indexes if above is correct)?

To compress all indexes on a table do:

ALTER INDEX ALL ON tbl REBUILD WITH (DATA_COMPRESSION = PAGE)

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

techresearch7777777-7743 avatar image
0 Votes"
techresearch7777777-7743 answered

Thanks Erland for confirming.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.