|
1 | 1 | ---
|
2 | 2 | title: "sys.internal_partitions (Transact-SQL)"
|
3 |
| -description: sys.internal_partitions (Transact-SQL) |
| 3 | +description: sys.internal_partitions returns one row for each rowset that tracks internal data for columnstore indexes on disk-based tables. |
4 | 4 | author: WilliamDAssafMSFT
|
5 | 5 | ms.author: wiassaf
|
6 |
| -ms.date: 06/26/2019 |
| 6 | +ms.reviewer: dfurman, randolphwest |
| 7 | +ms.date: 06/20/2025 |
7 | 8 | ms.service: sql
|
8 | 9 | ms.subservice: system-objects
|
9 |
| -ms.topic: "reference" |
| 10 | +ms.topic: reference |
10 | 11 | dev_langs:
|
11 |
| - - "TSQL" |
12 |
| -monikerRange: "=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current" |
| 12 | + - TSQL |
| 13 | +monikerRange: "=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current" |
13 | 14 | ---
|
| 15 | + |
14 | 16 | # sys.internal_partitions (Transact-SQL)
|
15 | 17 |
|
16 | 18 | [!INCLUDE [sqlserver2016-asdb-asdbmi](../../includes/applies-to-version/sqlserver2016-asdb-asdbmi.md)]
|
17 | 19 |
|
18 |
| - 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. [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] re-creates the rowsets each time it rebuilds the columnstore index. |
19 |
| - |
20 |
| -|Column name|Data type|Description| |
21 |
| -|-----------------|---------------|-----------------| |
22 |
| -|partition_id|**bigint**|Partition ID for this partition. This is unique within a database.| |
23 |
| -|object_id|**int**|Object ID for the table that contains the partition.| |
24 |
| -|index_id|**int**|Index ID for the columnstore index defined on the table.<br /><br /> 1 = clustered columnstore index<br /><br /> 2 = nonclustered columnstore index| |
25 |
| -|partition_number|**int**|The partition number.<br /><br /> 1 = first partition of a partitioned table, or the single partition of a nonpartitioned table.<br /><br /> 2 = second partition, and so on.| |
26 |
| -|internal_object_type|**tinyint**|Rowset objects that track internal data for the columnstore index.<br /><br /> 2 = COLUMN_STORE_DELETE_BITMAP<br /><br /> 3 = COLUMN_STORE_DELTA_STORE<br /><br /> 4 = COLUMN_STORE_DELETE_BUFFER<br /><br /> 5 = COLUMN_STORE_MAPPING_INDEX| |
27 |
| -|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.<br /><br /> 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.<br /><br /> 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.<br /><br /> 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.| |
28 |
| -|Row_group_id|**int**|ID for the deltastore rowgroup. Each table partition can have zero or more deltastore rowgroups.| |
29 |
| -|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.| |
30 |
| -|rows|**bigint**|Approximate number of rows in this partition.| |
31 |
| -|data_compression|**tinyint**|The state of compression for the rowset:<br /><br /> 0 = NONE<br /><br /> 1 = ROW<br /><br /> 2 = PAGE| |
32 |
| -|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.| |
33 |
| -|optimize_for_sequential_key|**bit**|1 = Partition has last-page insert optimization enabled.<br><br>0 = Default value. Partition has last-page insert optimization disabled.| |
34 |
| - |
35 |
| -## Permissions |
36 |
| - Requires membership in the `public` role. For more information, see [Metadata Visibility Configuration](../../relational-databases/security/metadata-visibility-configuration.md). |
37 |
| - |
38 |
| -## General Remarks |
39 |
| - [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] re-creates new columnstore internal indexes each time it creates or rebuilds a columnstore index. |
40 |
| - |
41 |
| -## Examples |
42 |
| - |
43 |
| -### A. View all of the internal rowsets for a table |
44 |
| - 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. |
45 |
| - |
46 |
| -```sql |
47 |
| -SELECT i.object_id, i.index_id, i.name, p.hobt_id, p.internal_object_type_id, p.internal_object_type_desc |
48 |
| -FROM sys.internal_partitions AS p |
49 |
| -JOIN sys.indexes AS i |
50 |
| -on i.object_id = p.object_id |
51 |
| -WHERE p.object_id = OBJECT_ID ( '<table name' ) ; |
52 |
| -``` |
53 |
| - |
54 |
| -## See Also |
55 |
| - [Object Catalog Views (Transact-SQL)](../../relational-databases/system-catalog-views/object-catalog-views-transact-sql.md) |
56 |
| - [Catalog Views (Transact-SQL)](../../relational-databases/system-catalog-views/catalog-views-transact-sql.md) |
57 |
| - [Querying the SQL Server System Catalog FAQ](../../relational-databases/system-catalog-views/querying-the-sql-server-system-catalog-faq.yml) |
58 |
| - |
59 |
| - |
| 20 | +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 table partition. Every table has at least one partition. The [!INCLUDE [ssDE](../../includes/ssde-md.md)] re-creates the rowsets each time it rebuilds the columnstore index. |
| 21 | + |
| 22 | +| Column name | Data type | Description | |
| 23 | +| --- | --- | --- | |
| 24 | +| `partition_id` | **bigint** | Partition ID for this partition. This is unique within a database. | |
| 25 | +| `object_id` | **int** | Object ID for the table that contains the partition. | |
| 26 | +| `index_id` | **int** | Index ID for the columnstore index defined on the table.<br /><br />1 = clustered columnstore index<br />2 = nonclustered columnstore index | |
| 27 | +| `partition_number` | **int** | The partition number.<br /><br />1 = first partition of a partitioned table, or the single partition of a nonpartitioned table.<br /><br />2 = second partition, and so on. | |
| 28 | +| `internal_object_type` | **tinyint** | Rowset objects that track internal data for the columnstore index.<br /><br />2 = `COLUMN_STORE_DELETE_BITMAP`<br />3 = `COLUMN_STORE_DELTA_STORE`<br />4 = `COLUMN_STORE_DELETE_BUFFER`<br />5 = `COLUMN_STORE_MAPPING_INDEX` | |
| 29 | +| `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. These rows are still physically present and take up space in the columnstore.<br /><br />`COLUMN_STORE_DELTA_STORE` - Stores groups of rows, called rowgroups, that haven't been compressed into columnar storage. Each table partition can have zero or more deltastore rowgroups.<br /><br />`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 exceeds 1,048,576, they're merged back into the delete bitmap by the Tuple Mover background thread or by an `ALTER INDEX ... REORGANIZE` operation. At any given point in time, the union of the delete bitmap and the delete buffer represents all deleted rows.<br /><br />`COLUMN_STORE_MAPPING_INDEX` - Used only when the clustered columnstore index has a secondary nonclustered index. This maps nonclustered index keys to the 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. | |
| 30 | +| `row_group_id` | **int** | ID for the deltastore rowgroup. Each table partition can have zero or more deltastore rowgroups. | |
| 31 | +| `hobt_id` | **bigint** | ID of the internal rowset object (HoBT). Can be used in joins with other system views and functions such as [sys.dm_db_index_physical_stats()](../system-dynamic-management-views/sys-dm-db-index-physical-stats-transact-sql.md) to get more information about the physical characteristics of the internal rowset. | |
| 32 | +| `rows` | **bigint** | Approximate number of rows in this partition. | |
| 33 | +| `data_compression` | **tinyint** | The compression type for each partition:<br /><br />0 = `NONE`<br />1 = `ROW`<br />2 = `PAGE` | |
| 34 | +| `data_compression_desc` | **nvarchar(60)** | The compression type for each partition. Possible values for rowstore tables are `NONE`, `ROW`, and `PAGE`. Possible values for columnstore tables are `COLUMNSTORE` and `COLUMNSTORE_ARCHIVE`. | |
| 35 | + |
| 36 | +## Permissions |
| 37 | + |
| 38 | +Requires membership in the `public` role. For more information, see [Metadata Visibility Configuration](../security/metadata-visibility-configuration.md). |
| 39 | + |
| 40 | +## Remarks |
| 41 | + |
| 42 | +The [!INCLUDE [ssDE](../../includes/ssde-md.md)] re-creates new columnstore internal indexes each time it creates or rebuilds a columnstore index. |
| 43 | + |
| 44 | +## Examples |
| 45 | + |
| 46 | +### A. View all of the internal rowsets for a table |
| 47 | + |
| 48 | +This example returns all of the internal columnstore rowsets for a table. You can also use the `hobt_id` column to join with other system views and functions and find more information about the specific rowset. |
| 49 | + |
| 50 | +```sql |
| 51 | +SELECT i.object_id, |
| 52 | + i.index_id, |
| 53 | + i.name, |
| 54 | + p.hobt_id, |
| 55 | + p.internal_object_type_id, |
| 56 | + p.internal_object_type_desc |
| 57 | +FROM sys.internal_partitions AS p |
| 58 | + INNER JOIN sys.indexes AS i |
| 59 | + ON i.object_id = p.object_id |
| 60 | +WHERE p.object_id = OBJECT_ID('<table name>'); |
| 61 | +``` |
| 62 | + |
| 63 | +## Related content |
| 64 | + |
| 65 | +- [Object catalog views (Transact-SQL)](object-catalog-views-transact-sql.md) |
| 66 | +- [System catalog views (Transact-SQL)](catalog-views-transact-sql.md) |
| 67 | +- [Querying the SQL Server system catalog FAQ](querying-the-sql-server-system-catalog-faq.yml) |
0 commit comments