Skip to content

Commit bfe2a6f

Browse files
Merge pull request #34490 from MicrosoftDocs/main
Merged by Learn.Build PR Management system
2 parents 664957f + 96ae1e2 commit bfe2a6f

File tree

6 files changed

+190
-160
lines changed

6 files changed

+190
-160
lines changed

docs/relational-databases/indexes/reorganize-and-rebuild-indexes.md

Lines changed: 59 additions & 47 deletions
Large diffs are not rendered by default.

docs/relational-databases/sql-server-transaction-locking-and-row-versioning-guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "Transaction locking and row versioning guide"
44
author: MikeRayMSFT
55
ms.author: mikeray
66
ms.reviewer: randolphwest, wiassaf
7-
ms.date: 02/05/2025
7+
ms.date: 06/20/2025
88
ms.service: sql
99
ms.subservice: performance
1010
ms.topic: conceptual
@@ -1191,15 +1191,15 @@ Each database row may use up to 14 bytes at the end of the row for row versionin
11911191
- The table has a trigger.
11921192
- Multiple Active Results Sets (MARS) is being used.
11931193
- Online index build operations are currently running on the table.
1194+
- [Accelerated database recovery (ADR)](/azure/azure-sql/accelerated-database-recovery) is enabled.
11941195
1195-
If the version store is in `tempdb`, these 14 bytes are removed from the database row the first time the row is modified under all of these conditions:
1196+
These 14 bytes are removed from the database row the first time the row is modified under all of these conditions:
11961197
11971198
- `READ_COMMITTED_SNAPSHOT` and `ALLOW_SNAPSHOT_ISOLATION` options are set to `OFF`.
11981199
- The trigger no longer exists on the table.
11991200
- MARS isn't being used.
12001201
- Online index build operations are not currently running.
1201-
1202-
The 14 bytes are also removed when a row is modified if ADR is no longer enabled and the above conditions are satisfied.
1202+
- [Accelerated database recovery (ADR)](/azure/azure-sql/accelerated-database-recovery) is disabled.
12031203

12041204
If you use any of the row versioning features, you might need to allocate additional disk space for the database to accommodate the 14 bytes per database row. Adding the row versioning information can cause index page splits or the allocation of a new data page if there isn't enough space available on the current page. For example, if the average row length is 100 bytes, the additional 14 bytes cause an existing table to grow up to 14 percent.
12051205
Lines changed: 55 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,67 @@
11
---
22
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.
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
6-
ms.date: 06/26/2019
6+
ms.reviewer: dfurman, randolphwest
7+
ms.date: 06/20/2025
78
ms.service: sql
89
ms.subservice: system-objects
9-
ms.topic: "reference"
10+
ms.topic: reference
1011
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"
1314
---
15+
1416
# sys.internal_partitions (Transact-SQL)
1517

1618
[!INCLUDE [sqlserver2016-asdb-asdbmi](../../includes/applies-to-version/sqlserver2016-asdb-asdbmi.md)]
1719

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 &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/object-catalog-views-transact-sql.md)
56-
[Catalog Views &#40;Transact-SQL&#41;](../../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)

docs/t-sql/functions/approx-percentile-cont-transact-sql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ monikerRange: "azuresqldb-current||=azuresqldb-mi-current||>=sql-server-2016||>=
2525

2626
This function returns an approximate interpolated value from the set of values in a group based on percentile value and sort specification. Since this is an approximate function, the output would be within rank based error bound with certain confidence. The percentile value returned by this function is based on a continuous distribution of the column values and the result would be interpolated. Due to this, the output might not be one of values in the data set. One of the common use cases for this function is to avoid the data outliers. This function can be used as an alternative to PERCENTILE_CONT for large datasets where negligible error with faster response is acceptable as compared to accurate percentile value with slow response time.
2727

28-
[Transact-SQL syntax conventions](../language-elements/transact-sql-syntax-conventions-transact-sql.md)
28+
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../language-elements/transact-sql-syntax-conventions-transact-sql.md)
2929

3030
## Syntax
3131

docs/t-sql/functions/approx-percentile-disc-transact-sql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ monikerRange: "azuresqldb-current||=azuresqldb-mi-current||>=sql-server-2016||>=
2525

2626
This function returns the value from the set of values in a group based on the provided percentile and sort specification. Since this is an approximate function, the output would be within rank based error bound with certain confidence. As this approximate percentile is based on a discrete distribution of the column values, the output value would be equal to one of the specific values in the column. This function can be used as an alternative to PERCENTILE_DISC for large datasets where negligible error with faster response is acceptable as compared to accurate percentile value with slow response time.
2727

28-
[Transact-SQL syntax conventions](../language-elements/transact-sql-syntax-conventions-transact-sql.md)
28+
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../language-elements/transact-sql-syntax-conventions-transact-sql.md)
2929

3030
## Syntax
3131

0 commit comments

Comments
 (0)