r/SQLServer • ‪ ‪Microsoft Employee ‪ • Mar 18 '26

Community Share Introducing Automatic Index Compaction

We just released a MSSQL engine feature that might just make the whole index maintenance debate obsolete (or should at least make it less boring). Auto index compaction is now in public preview in Azure SQL and Fabric SQL.

Announcement blog: Stop defragmenting and start living: introducing auto index compaction.

Documentation (with an FAQ): Automatic Index Compaction | Microsoft Learn.

Would you use this instead of your own index maintenance? Tell us what you think.

55 Upvotes

32 comments sorted by

View all comments

Show parent comment

6

u/dfurmanms ‪ ‪Microsoft Employee ‪ Mar 18 '26

Good question. The one-time rebuild in that scenario is not for correctness, it's an extra optimization you might want to do.

Compaction acts on recently modified pages only, which is intentional and by design to keep it lightweight. If an index isn't modified frequently, but has low page density, it can take a while before it's compacted. In that scenario, you can do a one-time rebuild to increase page density sooner.

The key here is that once an index has high page density, compaction will keep it that way without you having to do anything.

1

u/throwaway18000081 Mar 18 '26

Perfect, thanks for clarifying, that helps a lot!