Compression eligibility changes#549
Merged
erikdarlingdata merged 2 commits intoerikdarlingdata:devfrom Apr 3, 2025
Merged
Conversation
Owner
|
@FirstCall42 nice work! Thanks for taking care of this one. I assume this is tested and ready for merging now? |
Contributor
Author
|
I tested against sparse columns and text, ntext, and image columns. DROP TABLE IF EXISTS dbo.TableWithText;
CREATE TABLE dbo.TableWithText (
[Id] int CONSTRAINT PK_TableWithText PRIMARY KEY,
[Value1] int,
[TextValue] [text] NULL,
[NTextValue] [ntext],
[ImageValue] [image],
)
CREATE INDEX IX_Value1 ON dbo.TableWithText (Value1);
-- Some data
INSERT INTO dbo.TableWithText
SELECT TOP 100000
ROW_NUMBER() OVER (ORDER BY x.id),
CHECKSUM(NEWID()) % 10000,
CONCAT('magic text', x.id),
CASE WHEN x.id % 5 = 1 THEN CONCAT(N'magic ntext', x.id) ELSE NULL END,
CONCAT('magic image', x.id)
FROM sys.sysobjects x
CROSS JOIN sys.all_objects y
-- Queries to use the index
SELECT * FROM TableWithText WHERE Value1 = 8508
SELECT * FROM TableWithText WHERE Value1 > 0
EXEC sp_IndexCleanup @table_name = 'TableWithText' |
Owner
|
@FirstCall42 good enough for me! Thank you again for the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When checking for compression eligibility, indexes on tables with sparse columns should be flagged as ineligible.
Additionally, clustered indexes which contain columns with ineligible data types should also be flagged as ineligible.
Otherwise, the compression eligibility of each index will be based on the server and compatibility checks.