Redaguoti

Bendrinti naudojant


sys.internal_partitions (Transact-SQL)

Applies to: SQL Server 2016 (13.x) and later Azure SQL Database Azure SQL Managed Instance

Returns one row for each rowset that tracks internal data for columnstore indexes on disk-based tables. These rowsets are internal to columnstore indexes and track deleted rows, rowgroup mappings, and delta store rowgroups. They track data for each for each table partition; every table has at least one partition. SQL Server re-creates the rowsets each time it rebuilds the columnstore index.

Column name Data type Description
partition_id bigint Partition ID for this partition. This is unique within a database.
object_id int Object ID for the table that contains the partition.
index_id int Index ID for the columnstore index defined on the table.

1 = clustered columnstore index

2 = nonclustered columnstore index
partition_number int The partition number.

1 = first partition of a partitioned table, or the single partition of a nonpartitioned table.

2 = second partition, and so on.
internal_object_type tinyint Rowset objects that track internal data for the columnstore index.

2 = COLUMN_STORE_DELETE_BITMAP

3 = COLUMN_STORE_DELTA_STORE

4 = COLUMN_STORE_DELETE_BUFFER

5 = COLUMN_STORE_MAPPING_INDEX
internal_object_type_desc nvarchar(60) COLUMN_STORE_DELETE_BITMAP - This bitmap index tracks rows that are marked as deleted from the columnstore. The bitmap is for every rowgroup since partitions can have rows in multiple rowgroups. The rows are that are still physically present and taking up space in the columnstore.

COLUMN_STORE_DELTA_STORE - Stores groups of rows, called rowgroups, that have not been compressed into columnar storage. Each table partition can have zero or more deltastore rowgroups.

COLUMN_STORE_DELETE_BUFFER - For maintaining deletes to updateable nonclustered columnstore indexes. When a query deletes a row from the underlying rowstore table, the delete buffer tracks the deletion from the columnstore. When the number of deleted rows exceed 1048576, they are merged back into the delete bitmap by background Tuple Mover thread or by an explicit Reorganize command. At any given point in time, the union of the delete bitmap and the delete buffer represents all deleted rows.

COLUMN_STORE_MAPPING_INDEX - Used only when the clustered columnstore index has a secondary nonclustered index. This maps nonclustered index keys to the correct rowgroup and row ID in the columnstore. It only stores keys for rows that move to a different rowgroup; this occurs when a delta rowgroup is compressed into the columnstore, and when a merge operation merges rows from two different rowgroups.
Row_group_id int ID for the deltastore rowgroup. Each table partition can have zero or more deltastore rowgroups.
hobt_id bigint ID of the internal rowset object (HoBT). This is a good key for joining with other DMVs to get more information about the physical characteristics of the internal rowset.
rows bigint Approximate number of rows in this partition.
data_compression tinyint The state of compression for the rowset:

0 = NONE

1 = ROW

2 = PAGE
data_compression_desc nvarchar(60) The state of compression for each partition. Possible values for rowstore tables are NONE, ROW, and PAGE. Possible values for columnstore tables are COLUMNSTORE and COLUMNSTORE_ARCHIVE.
optimize_for_sequential_key bit 1 = Partition has last-page insert optimization enabled.

0 = Default value. Partition has last-page insert optimization disabled.

Permissions

Requires membership in the public role. For more information, see Metadata Visibility Configuration.

General Remarks

SQL Server re-creates new columnstore internal indexes each time it creates or rebuilds a columnstore index.

Examples

A. View all of the internal rowsets for a table

This example returns all of the internal columnstore rowsets for a table. You can also use the hobt_id to find more information about the specific rowset.

SELECT i.object_id, i.index_id, i.name, p.hobt_id, p.internal_object_type_id, p.internal_object_type_desc  
FROM sys.internal_partitions AS p  
JOIN sys.indexes AS i  
on i.object_id = p.object_id  
WHERE p.object_id = OBJECT_ID ( '<table name' ) ;  

See Also

Object Catalog Views (Transact-SQL)
Catalog Views (Transact-SQL)
Querying the SQL Server System Catalog FAQ