Skip to content

Fix the delete bitmap description and example A of sys.internal_partitions - #10487

Open
Rudi Bruchez (rudi-bruchez) wants to merge 1 commit into
MicrosoftDocs:livefrom
rudi-bruchez:fix/internal-partitions-bitmap-example
Open

Rudi Bruchez (rudi-bruchez) wants to merge 1 commit into
MicrosoftDocs:livefrom
rudi-bruchez:fix/internal-partitions-bitmap-example

Conversation

@rudi-bruchez

Copy link
Copy Markdown
Contributor

What's wrong

  • COLUMN_STORE_DELETE_BITMAP is described with "The bitmap is for every rowgroup since partitions can have rows in multiple rowgroups", which reads as one bitmap per rowgroup. There's one delete bitmap row per partition, with row_group_id NULL, and its rows value counts the deleted rows of all the rowgroups of the partition.
  • Example A selects p.internal_object_type_id, which doesn't exist: the column is internal_object_type. The query fails with Msg 207, "Invalid column name 'internal_object_type_id'". It also joins sys.indexes on object_id only, so each internal rowset is returned once for every index of the table.

Evidence

SQL Server 2025 CU10 (17.0.5035.5), Linux container, Developer edition. Fresh database; a table partitioned in two, with a clustered columnstore index and a nonclustered index, three compressed rowgroups in partition 1 and one in partition 2, then 0.1% of the rows deleted.

CREATE PARTITION FUNCTION pf (int) AS RANGE RIGHT FOR VALUES (5000000);
CREATE PARTITION SCHEME ps AS PARTITION pf ALL TO ([PRIMARY]);
CREATE TABLE dbo.T (Id int NOT NULL, V int NOT NULL) ON ps(Id);
CREATE CLUSTERED COLUMNSTORE INDEX cci ON dbo.T ON ps(Id);
CREATE NONCLUSTERED INDEX ix ON dbo.T (V) ON ps(Id);
-- three compressed rowgroups in partition 1, one in partition 2
INSERT dbo.T WITH (TABLOCK) SELECT TOP (3145728) ROW_NUMBER() OVER (ORDER BY (SELECT NULL)), 1 FROM sys.all_columns a CROSS JOIN sys.all_columns b CROSS JOIN sys.all_columns c;
INSERT dbo.T WITH (TABLOCK) SELECT TOP (1048576) 5000000 + ROW_NUMBER() OVER (ORDER BY (SELECT NULL)), 1 FROM sys.all_columns a CROSS JOIN sys.all_columns b CROSS JOIN sys.all_columns c;
DELETE dbo.T WHERE Id % 1000 = 0;
GO
SELECT partition_number, internal_object_type, internal_object_type_desc, row_group_id, rows
FROM sys.internal_partitions
WHERE object_id = OBJECT_ID('dbo.T')
ORDER BY partition_number, internal_object_type;
partition_number internal_object_type_desc row_group_id rows
1 COLUMN_STORE_DELETE_BITMAP NULL 3145
2 COLUMN_STORE_DELETE_BITMAP NULL 1048

sys.column_store_row_groups shows rowgroups 0, 1 and 2 in partition 1 (1,048, 1,049 and 1,048 deleted rows) and rowgroup 0 in partition 2 (1,048 deleted rows).

Example A as published returns Msg 207. With internal_object_type and the join on object_id only, it returns 4 rows for these 2 rowsets; with the join on object_id and index_id, 2 rows.

Change

Says that each columnstore index partition has one delete bitmap, shared by its compressed rowgroups (deletes in a delta store rowgroup don't go to the bitmap), and that the rows marked in it are still physically present. In example A, selects internal_object_type and joins sys.indexes on index_id too.

@prmerger-automator

Copy link
Copy Markdown
Contributor

Rudi Bruchez (@rudi-bruchez) : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

1 similar comment
@prmerger-automator

Copy link
Copy Markdown
Contributor

Rudi Bruchez (@rudi-bruchez) : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 65b7c37:

✅ Validation status: passed

File Status Preview URL Details
docs/relational-databases/system-catalog-views/sys-internal-partitions-transact-sql.md ✅Succeeded

For more details, please refer to the build report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants