Skip to content

Commit 7ebf97e

Browse files
Refactor
1 parent d1d341e commit 7ebf97e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ The result set returned by `sys.dm_db_column_store_row_group_physical_stats` inc
8989
| `total_rows` | Number of rows physically stored in the row group. For compressed row groups, this includes the rows that are marked as deleted. |
9090
| `deleted_rows` | Number of rows physically stored in a compressed row group that are marked for deletion. 0 for row groups that are in delta store. |
9191

92-
To determine the total number of physically stored deleted rows for a nonclustered columnstore index, add the value in the `deleted_rows` column in `sys.dm_db_column_store_row_group_physical_stats` to the value in the `rows` column in [sys.internal_partitions](../system-catalog-views/sys-internal-partitions-transact-sql.md) for the internal object type `COLUMN_STORE_DELETE_BUFFER` and the same object, index, and partition.
93-
9492
Compressed row group fragmentation in a columnstore index can be computed using this formula:
9593

9694
```sql
97-
100.0 * (ISNULL(total_deleted_rows, 0)) / NULLIF(total_rows, 0)
95+
100.0 * (ISNULL(total_stored_deleted_rows, 0)) / NULLIF(total_rows, 0)
9896
```
9997

98+
To determine the total number of physically stored deleted rows for a nonclustered columnstore index, add the value in the `deleted_rows` column in `sys.dm_db_column_store_row_group_physical_stats` to the value in the `rows` column in [sys.internal_partitions](../system-catalog-views/sys-internal-partitions-transact-sql.md) for the internal object type `COLUMN_STORE_DELETE_BUFFER` and the same object, index, and partition. For an example, see [Check the fragmentation of a columnstore index](#check-the-fragmentation-of-a-columnstore-index).
99+
100100
> [!TIP]
101101
> For both rowstore and columnstore indexes, review index or heap fragmentation and page density after a large number of rows is deleted or updated. For heaps, if there are frequent updates, review fragmentation periodically to avoid proliferation of forwarding records. For more information about heaps, see [Heaps (Tables without Clustered Indexes)](../../relational-databases/indexes/heaps-tables-without-clustered-indexes.md#heap-structures).
102102
@@ -297,7 +297,7 @@ For an [!INCLUDE [ssazuresynapse-md](../../includes/ssazuresynapse-md.md)] table
297297

298298
## Examples
299299

300-
### Check the fragmentation and page density of a rowstore index using [!INCLUDE [tsql](../../includes/tsql-md.md)]
300+
### Check the fragmentation and page density of a rowstore index
301301

302302
The following example determines the average fragmentation and page density for all rowstore indexes in the current database. It uses the `SAMPLED` mode to return actionable results quickly. For more accurate results, use the `DETAILED` mode. This requires scanning all index pages, and can take a long time.
303303

@@ -333,7 +333,7 @@ dbo DimCustomer IX_DimCustomer_CustomerAlternateKey NONC
333333

334334
For more information, see [sys.dm_db_index_physical_stats](../../relational-databases/system-dynamic-management-views/sys-dm-db-index-physical-stats-transact-sql.md).
335335

336-
### Check the fragmentation of a columnstore index using [!INCLUDE [tsql](../../includes/tsql-md.md)]
336+
### Check the fragmentation of a columnstore index
337337

338338
The following example determines the average fragmentation for all columnstore indexes with compressed row groups in the current database.
339339

0 commit comments

Comments
 (0)