Skip to content

Commit 9a6959a

Browse files
Merge pull request #36925 from dimitri-furman/dfurman/fill-factor
Copilot-inspired tweaks to index content
2 parents faee0ce + 6a8c1ee commit 9a6959a

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

docs/relational-databases/indexes/automatic-index-compaction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Consider the following differences between the traditional index maintenance ope
114114
| Unlike index reorganization and rebuild which process all pages, the compaction process only considers the pages modified after you enable automatic index compaction. | If the page density for an index is already low, consider running a one-time index reorganization or index rebuild to increase it. This one-time operation is an extra optimization to increase page density right away. From that point on, automatic compaction keeps indexes compact without any user action. |
115115
| Each index rebuild operation requires a substantial free space in the data files, commonly equal to the size of the index or partition being rebuilt. | You don't need to allocate free space in data files for automatic index compaction or for index reorganization. |
116116
| Unlike index rebuild or index reorganization, compaction doesn't reduce index fragmentation. | Increased page density after compaction is more important than index fragmentation. For most workloads, a higher index fragmentation doesn't affect query performance or resource consumption. |
117-
| When the fill factor for an index is less than 100 percent but the amount of data on a page exceeds the fill factor, neither index compaction nor reorganization move rows away from the page. An index rebuild creates new pages and fills them according to the fill factor. | For most workloads, a higher page density is preferred. Workloads that require a lower fill factor to reduce page splits might benefit from an occasional index rebuild. The rebuild creates pages with a lower page density that matches the fill factor. |
117+
| When the fill factor for an index is less than 100 percent but the amount of data on a page exceeds the fill factor, neither index compaction nor reorganization moves rows away from the page. An index rebuild creates new pages and fills them according to the fill factor. | For most workloads, a higher page density is preferred. Workloads that require a lower fill factor to reduce page splits might benefit from an occasional index rebuild. The rebuild creates pages with a lower page density that matches the fill factor. |
118118
| Unlike index rebuild, compaction doesn't update statistics on the index. | If [automatic statistics update](../statistics/statistics.md#auto_update_statistics-option) is insufficient for your workload and you rely on the [index rebuild to update statistics](reorganize-and-rebuild-indexes.md#a-positive-side-effect-of-index-rebuild), consider using automatic compaction in combination with a statistics update job. |
119119

120120
For more information about index reorganization and rebuild, see [Optimize index maintenance to improve query performance and reduce resource consumption](reorganize-and-rebuild-indexes.md).

docs/relational-databases/indexes/specify-fill-factor-for-an-index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ When a new row is added to a full index page, the [!INCLUDE[ssDE](../../includes
5252

5353
A well-chosen fill factor value can reduce page splits by providing enough space for index expansion when data is added in the middle of the index. If page splits affect performance, the index can be rebuilt by using a new or existing fill factor value in the 70-95 percent range. However, don't reduce the fill factor unnecessarily or set it too low. For more information, see [Optimize index maintenance to improve query performance and reduce resource consumption](../../relational-databases/indexes/reorganize-and-rebuild-indexes.md).
5454

55-
Most workloads perform optimally with the default 100 percent fill factor. With a reduced fill factor, the index requires more storage space, memory, and disk I/O, which can decrease performance. Even for a write-intensive workload, database reads typically outnumber database writes by a factor of five to ten. Therefore, specifying a fill factor other than the default can increase resource utilization by an amount inversely proportional to the fill factor setting.
55+
Most workloads perform optimally with the default fill factor (100 percent). With a reduced fill factor, the index requires more storage space, memory, and disk I/O, which can decrease performance. Even for a write-intensive workload, database reads typically outnumber database writes by a factor of five to ten. Therefore, specifying a fill factor other than the default can increase resource utilization by an amount inversely proportional to the fill factor setting.
5656

5757
For example, a fill factor value of 50 doubles the disk I/O and memory required to read and cache the same amount of data.
5858

docs/relational-databases/system-dynamic-management-views/sys-dm-db-index-physical-stats-transact-sql.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,11 @@ When an index is fragmented in a way that is affecting query performance, there
205205

206206
Recreating a clustered index redistributes the data and results in full data pages. The level of fullness can be configured by using the `FILLFACTOR` option in `CREATE INDEX`. The drawbacks in this method are that the index is offline during the drop and recreate cycle, and that the operation is atomic. If the index creation is interrupted, the index isn't recreated. For more information, see [CREATE INDEX](../../t-sql/statements/create-index-transact-sql.md).
207207

208-
- Use `ALTER INDEX REORGANIZE`, the replacement for `DBCC INDEXDEFRAG`, to reorder the leaf level pages of the index in a logical order. Because this is an online operation, the index is available while the statement is running. The operation can also be interrupted without losing work already completed. The drawback in this method is that it doesn't reduce page fullness to the level specified by the fill factor, which might cause more page splits over time. Unlike recreating or rebuilding an index, `ALTER INDEX REORGANIZE` doesn't update statistics.
208+
- Use `ALTER INDEX REORGANIZE`, the replacement for `DBCC INDEXDEFRAG`, to reorder the leaf level pages of the index in a logical order. Because this is an online operation, the index is available while the statement is running. The operation can also be interrupted without losing work already completed. This method compacts pages and can increase page density up to the fill factor, but it doesn't move rows off already-full pages to create free space according to a lower fill factor. Compared to `ALTER INDEX REBUILD` with a lower fill factor, `ALTER INDEX REORGANIZE` might cause more page splits for some workloads over time.
209209

210-
- Use `ALTER INDEX REBUILD`, the replacement for `DBCC DBREINDEX`, to rebuild the index online or offline. For more information, see [ALTER INDEX (Transact-SQL)](../../t-sql/statements/alter-index-transact-sql.md).
210+
Unlike recreating or rebuilding an index, `ALTER INDEX REORGANIZE` doesn't update statistics.
211+
212+
- Use `ALTER INDEX REBUILD`, the replacement for `DBCC DBREINDEX`, to rebuild the index. An online rebuild keeps the data accessible during the operation but isn't available in all [!INCLUDE [ssdenoversion-md](../../includes/ssdenoversion-md.md)] editions. For more information, see [ALTER INDEX (Transact-SQL)](../../t-sql/statements/alter-index-transact-sql.md).
211213

212214
Fragmentation alone isn't a sufficient reason to reorganize or rebuild an index. The main effect of fragmentation is that it might reduce the effectiveness of [page read-ahead](../reading-pages.md#read-ahead) during large index scans. If the query workload on a fragmented table or index doesn't involve large scans, removing fragmentation has no effect.
213215

@@ -233,7 +235,7 @@ The `avg_page_space_used_in_percent` column indicates page fullness, or page den
233235

234236
If page splits significantly affect workload performance, you might need to reduce page density below 100 percent. Rebuilding an index with the `FILLFACTOR` option specified allows the page fullness to be changed to better match this specific workload pattern. For more information about fill factor, see [Specify Fill Factor for an Index](../indexes/specify-fill-factor-for-an-index.md).
235237

236-
`ALTER INDEX REORGANIZE` compacts an index by trying to fill pages up to the `FILLFACTOR` value that was last specified. This increases the value in `avg_space_used_in_percent`. However, if a page is already filled above the `FILLFACTOR` value, `ALTER INDEX REORGANIZE` can't reduce page fullness and page splits. Instead, an index rebuild must be performed.
238+
`ALTER INDEX REORGANIZE` compacts an index by trying to fill pages up to the `FILLFACTOR` value that was last specified. This increases the value in `avg_page_space_used_in_percent`. However, if a page is already filled above the `FILLFACTOR` value, `ALTER INDEX REORGANIZE` can't reduce page fullness and page splits. Instead, an index rebuild must be performed.
237239

238240
## Evaluate index fragments
239241

0 commit comments

Comments
 (0)