Skip to content

sp_IndexCleanup: compression ineligible indexes incorrectly flags compressible indexes #547

@FirstCall42

Description

@FirstCall42

Version of the script
1.4

What is the current behavior?
Indexes which belong to tables that have text, ntext, image or filestream columns are marked as ineligible for compression, even though the indexes themselves may not contain any text, ntext, image, or filestream columns.

If the current behavior is a bug, please provide the steps to reproduce.

DROP TABLE IF EXISTS dbo.TableWithText;
CREATE TABLE dbo.TableWithText (
	[Id] int CONSTRAINT PK_TableWithText PRIMARY KEY,
	[Value1] int,
	[TextValue] [text]
)

INSERT INTO dbo.TableWithText
SELECT TOP 1000
	x.id,
	CHECKSUM(NEWID()) % 10000,
	CONCAT('magic', x.id)
FROM sys.sysobjects x

CREATE INDEX IX_Value1 ON dbo.TableWithText (Value1);

EXEC sp_IndexCleanup @table_name = 'TableWithText'

What is the expected behavior?
Indexes which contain fields with restricted data types should be reported as COMPRESSION INELIGIBLE, but indexes which do not contain restricted fields should be compressible.

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?

IMPORTANT: If you're going to contribute code, please read the contributing guide first.
https://github.com/erikdarlingdata/DarlingData/blob/main/CONTRIBUTING.md

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingsp_IndexCleanupReview unused and duplicative indexes

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions