tigertoolbox icon indicating copy to clipboard operation
tigertoolbox copied to clipboard

[AdaptiveIndexDefrag] null @DataCompression parameter leads to null @rebuildCommand

Open paolov opened this issue 6 years ago • 2 comments

If @DataCompression is null, according to spec, it should preserve existing compression for an index. Instead when a rebuild or regenerate is needed, the @rebuildCommand evaluate to null after lines 1613-1630 because @currCompression is always null.

I could not find a place where the column 'compression_type' in table 'tbl_AdaptiveIndexDefrag_Working' gets populated with existing values, so rows in that table default to null for 'compression_type' and when the code retrieve the single record to build the @rebuildCommand and executes @rebuildcommand = @rebuildcommand + N'DATA_COMPRESSION = ' + @currCompression ' @rebuildcommand becomes NULL and subsequently no ALTER INDEX gets executed.

All the relate debug messages are also lost for the same reason: varchar + NULL = NULL

paolov avatar Oct 26 '18 09:10 paolov

HI, should be fixed with #94 just checked-in for v1.6.6.6. Can you please verify?

pmasl avatar Oct 28 '18 22:10 pmasl

At line 1635 should be IF @dataCompression IS NULL AND @ixtype IN (1,2) and @currCompression is not null

d-moloney avatar Oct 30 '18 16:10 d-moloney