Azure DataCenter
  • All of Microsoft
  • My Role
    • Alles zu My Role
    • Azure DataCenter
  • Focus
    • Alles zu Focus
    • Microsoft Ignite 2026
    • Azure Weekly Update
    • Azure Master Class
    • What's Hot
    • M365 Release
Zeitspanne
explore our new search
Azure SQL Automatic Index Compaction reduces sparse pages
Databases

Azure SQL Automatic Index Compaction reduces sparse pages

von HubSite 365 über Microsoft

Software Development Redmond, Washington

Automatic Index Compaction consolidates eligible Azure SQL index pages in the background, helping database teams reduce page reads after data changes.

Key insights

  • Compaction consolidates eligible, recently modified index pages in the background.
  • The process can move rows between neighboring pages and deallocate pages that become empty.
  • Microsoft's demo reports page density rising from 47.1% to 95.0% after compaction.
  • Automatic Index Compaction does not update statistics; statistics maintenance remains separate.
  • Microsoft notes possible increases in transaction-log write I/O and backup size.

Azure SQL Automatic Index Compaction improves index page density by consolidating eligible pages in the background, potentially reducing the number of pages queries must read. It matters to database administrators and teams managing write-intensive Azure SQL workloads with frequent inserts, updates, or deletes. Microsoft demonstrates the compaction effect in an Azure SQL Hyperscale example.

What it does

When rows are deleted or updated, index pages can become sparsely populated even if fragmentation percentage alone does not flag the main problem. Low page density means an operation may need to read more pages than a compact index would require. Compaction targets page utilization, rather than rebuilding an entire index.

The engine works asynchronously through background processing associated with the Persistent Version Store cleaner. It can move rows from a neighboring page into available space, while respecting the index fill factor, and deallocate pages that become empty. In Microsoft's demo, page density rose from 47.1% after scattered deletes to 95.0% after compaction; the page count fell from 18,004 to 8,909.

Who it is for and what you need

This is relevant to database teams responsible for Azure SQL Database and Azure SQL Managed Instance workloads where ongoing data changes leave indexes with underused pages. Automatic Index Compaction is generally available for Azure SQL Database, Azure SQL Managed Instance with the Always-up-to-date update policy, and SQL database in Microsoft Fabric.

The starting point is the database that contains the affected indexes. Evaluate the setting against a representative workload and compare index page density, logical reads, and query performance before relying on it to change maintenance routines.

How it works

Unlike scheduled maintenance that evaluates and reorganizes or rebuilds indexes as a whole, automatic compaction works incrementally on eligible pages affected by data changes. It is intended to reduce sparse-page overhead without requiring an administrator to initiate a full index operation.

  1. Enable the database-level Automatic Index Compaction option where supported.
  2. Let background processing identify eligible pages and consolidate their contents.
  3. Monitor page density, logical reads, query performance, and transaction-log activity.

Limitations and alternatives

Compaction is not a substitute for every index-maintenance task. It does not update statistics, so statistics maintenance remains separate. It focuses on eligible, recently modified pages rather than scanning and optimizing every page in every index.

Microsoft also notes that compaction can increase transaction-log write I/O and transaction-log backup size in write-intensive workloads. Keep existing maintenance decisions tied to the workload's needs, and monitor those costs alongside read performance. The demo's measurements describe one workload, not a guaranteed result for every database.

Sources

Frequently asked questions

What does Azure SQL Automatic Index Compaction do?

It consolidates eligible index pages in the background, moving rows into available space and deallocating pages that become empty. This can improve page density and reduce pages read.

Does Automatic Index Compaction update SQL statistics?

No. Statistics maintenance remains a separate task.

Which services have Automatic Index Compaction?

It is generally available in Azure SQL Database, Azure SQL Managed Instance with the Always-up-to-date update policy, and SQL database in Microsoft Fabric.

Can Automatic Index Compaction affect transaction logs?

It can increase transaction-log write I/O and transaction-log backup size, particularly in write-intensive workloads.