{"id":45961,"date":"2026-07-29T01:46:39","date_gmt":"2026-07-28T23:46:39","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/?p=45961"},"modified":"2026-07-29T02:04:52","modified_gmt":"2026-07-29T00:04:52","slug":"sql-server-automatic-index-compaction-preview-part-1","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/","title":{"rendered":"SQL Server: Automatic index compaction in Azure (preview) \u2013 Part 1"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">For years, we have all scheduled the same thing on our SQL Server environments: a nightly or weekly index maintenance job. We check the fragmentation level, we run a REORGANIZE between 5% and 30%, a REBUILD above 30% and we hope the job finishes before the business day starts.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Microsoft recently released a new feature in public preview: automatic index compaction. The database engine takes care of compacting the indexes itself, in the background, while the data changes. No job, no maintenance window, no script to maintain.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is what we will cover in this blog post<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Which problems this feature addresses<\/li>\n\n\n\n<li>The requirements<\/li>\n\n\n\n<li>The difference between page density and index fragmentation (and why it matters)<\/li>\n\n\n\n<li>What the feature does not do<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This is the first part of a series of two blog posts.<\/p>\n\n\n\n<h2 id=\"h-which-problems-does-it-address\" class=\"wp-block-heading\">Which problems does it address?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Automatic index compaction is Microsoft&#8217;s answer to a routine operational task: index maintenance jobs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here are the problems with these jobs<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>They are expensive in CPU and I\/O. A rebuild reads and rewrites the entire index<\/li>\n\n\n\n<li>They take time to run, and maintenance windows keep shrinking<\/li>\n\n\n\n<li>They generate a lot of transaction log, which impacts log backups and Always On replication<\/li>\n\n\n\n<li>They can block applications. An offline rebuild locks the table and even an online rebuild needs a short exclusive lock at the beginning and at the end<\/li>\n\n\n\n<li>Someone has to set them up, monitor them and fix them when they fail<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">There is also a less obvious problem: for years, these jobs have been optimizing the wrong metric. We will come back to this point in a moment.<\/p>\n\n\n\n<h2 id=\"h-requirements\" class=\"wp-block-heading\">Requirements<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The feature is currently in public preview and available on<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Azure SQL Database<\/li>\n\n\n\n<li>Azure SQL Managed Instance, with the Always-up-to-date update policy<\/li>\n\n\n\n<li>SQL database in Microsoft Fabric<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">It is not available on SQL Server on-premises, including SQL Server 2025.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There is nothing to install. The feature relies on a background process that already runs on these platforms (the ADR cleaner, more on this below), and Accelerated Database Recovery is always enabled on Azure SQL Database, Azure SQL Managed Instance and SQL database in Fabric.<\/p>\n\n\n\n<h2 id=\"h-internal-and-external-fragmentation\" class=\"wp-block-heading\">Internal and external fragmentation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When we talk about index fragmentation, we are actually talking about two different phenomena. They are measured by two different columns of sys.dm_db_index_physical_stats, they have different causes, and above all they have very different costs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before we start: how is a data file organized ?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To understand fragmentation, we need one prerequisite: how SQL Server sees its data files.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For any program, a file is an array of bytes provided by the operating system. Byte 0, byte 1, byte 2, and so on. Reading means asking for a range: an offset and a length<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SQL Server slices this array into pages of 8 KB. The page N is, by definition, the bytes N \u00d7 8192 to (N+1) \u00d7 8192 \u2212 1. The page ID is not a label, it is an address in the file<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Everything below the file (NTFS clusters, SSD, SAN volumes) is translated and hidden by the storage stack.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Every time we say &#8220;physical order&#8221; in the rest of this post, we mean the order of the pages inside the data file not their placement on the hardware.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What does it look like?<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"740\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-26.png\" alt=\"\" class=\"wp-image-45980\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-26.png 960w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-26-300x231.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-26-768x592.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/figure>\n\n\n\n<h2 id=\"h-internal-fragmentation-the-pages-are-not-full\" class=\"wp-block-heading\">Internal fragmentation: the pages are not full<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Internal fragmentation means that the pages of an index contain free space. It is measured by avg_page_space_used_in_percent, also called page density.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Where does it come from?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Deletes, especially scattered deletes: the rows disappear, the pages stay<\/li>\n\n\n\n<li>Page splits: when a page is full, an insert in the middle of the key range or an update that makes a row grow moves half of the rows to a newly allocated page. Both pages end up around 50% full<\/li>\n\n\n\n<li>Updates that shrink variable length columns<\/li>\n\n\n\n<li>Large rows that do not pack well: a 5000 bytes row means one row per page, and around 38% of every page is lost mechanically<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Note that some free space is normal, and even intentional: the space reserved by the fill factor is internal fragmentation on purpose to absorb future inserts without page splits.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What does it look like?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE DATABASE DemoFrag\nGO\n\nALTER DATABASE DemoFrag SET RECOVERY SIMPLE\nGO\n\nUSE DemoFrag\nGO\n\nCREATE TABLE dbo.SplitDemo (\n    Id      int NOT NULL CONSTRAINT PK_SplitDemo PRIMARY KEY CLUSTERED,\n    Payload varchar(8000) NOT NULL\n);\n\n-- 2 lines about 4000 bytes per page\nINSERT INTO dbo.SplitDemo VALUES\n(1, REPLICATE('A', 4000)), (2, REPLICATE('B', 4000));<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">My page is almost full:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"865\" height=\"43\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-25.png\" alt=\"\" class=\"wp-image-45976\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-25.png 865w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-25-300x15.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-25-768x38.png 768w\" sizes=\"auto, (max-width: 865px) 100vw, 865px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why does it cost ?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because the same rows are spread over more pages than necessary and everything in SQL Server is done at the page level:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The buffer pool caches pages, not rows. A page at 40% density wastes 60% of the memory it occupies<\/li>\n\n\n\n<li>Every read, logical or physical, handles more pages for the same data<\/li>\n\n\n\n<li>Backups are bigger, integrity checks are longer<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This is the key point: internal fragmentation follows the data everywhere, including in RAM. It is a permanent tax on memory, I\/O and CPU. However it&#8217;s not the case with external fragmentation.<\/p>\n\n\n\n<h2 id=\"h-external-fragmentation-the-offsets-do-not-follow-the-logical-order\" class=\"wp-block-heading\">External fragmentation: the offsets do not follow the logical order<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">At the leaf level of a B-tree, the pages are chained together in the order of the index keys with two pointers stored in every page header (m_nextPage, m_prevPage). This chain is the logical order and it cannot be wrong: it is the order of the keys by definition.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">External fragmentation (also called logical fragmentation) means that following this chain no longer corresponds to reading the file sequentially. The pages are logically ordered, but their offsets in the file are not. It takes two forms:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Holes<\/strong>: the pages of the index are not at consecutive offsets. Pages of other objects, or free pages, sit in between<\/li>\n\n\n\n<li><strong>Disorder<\/strong>: the pages are at consecutive offsets, but chained in a different order<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">avg_fragmentation_in_percent counts both forms without distinction. The columns fragment_count and avg_fragment_size_in_pages are closer to the real cost: they measure the length of the contiguous runs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Where does it come from?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Several objects growing at the same time: the engine allocates the extents in the order the requests arrive, so the objects interleave in the file. This is the normal life of a database<\/li>\n\n\n\n<li>Page splits: the new page is allocated where free space is found, rarely next to the original page<\/li>\n\n\n\n<li>Page deallocations: massive deletes, and the automatic index compaction itself<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What does it look like?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>USE DemoFrag\nGO\n\nCREATE TABLE dbo.SplitDemo (\n&nbsp;&nbsp;&nbsp; Id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int NOT NULL CONSTRAINT PK_SplitDemo PRIMARY KEY CLUSTERED,\n&nbsp;&nbsp;&nbsp; Payload varchar(8000) NOT NULL\n);\n\n-- 2 lines about 4000 bytes per page : lines 1 and 2 on 1 page, 3-4 on next page\n\nINSERT INTO dbo.SplitDemo VALUES\n(1, REPLICATE('A', 4000)), (2, REPLICATE('B', 4000)),\n(3, REPLICATE('C', 4000)), (4, REPLICATE('D', 4000))\n\n-- Lines location (file:page:slot)?\nSELECT Id, sys.fn_PhysLocFormatter(%%physloc%%) AS physical_location\nFROM dbo.SplitDemo;<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"163\" height=\"122\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-21.png\" alt=\"\" class=\"wp-image-45969\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">My first 2 rows are located on page 376 and the last 2 rows on page 378.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What does page 377 contain? I thought the pages were contiguous?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since my table has a clustered index on Id it is stored as a B-tree. Can we see it?<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT allocated_page_page_id, page_type_desc, page_level, previous_page_page_id, next_page_page_id\nFROM sys.dm_db_database_page_allocations(DB_ID(), OBJECT_ID('dbo.SplitDemo'),1, NULL, 'DETAILED');<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"540\" height=\"196\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-16.png\" alt=\"\" class=\"wp-image-45966\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-16.png 540w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-16-300x109.png 300w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What does it look like internally?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM sys.dm_db_page_info (10, 1, 376, DEFAULT);<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"931\" height=\"44\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-19.png\" alt=\"\" class=\"wp-image-45971\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-19.png 931w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-19-300x14.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-19-768x36.png 768w\" sizes=\"auto, (max-width: 931px) 100vw, 931px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM sys.dm_db_page_info (10, 1, 378, DEFAULT);<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"45\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-18-1024x45.png\" alt=\"\" class=\"wp-image-45968\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-18-1024x45.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-18-300x13.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-18-768x34.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-18.png 1051w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Page split to generate external fragmentation:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Split happens\nUPDATE dbo.SplitDemo SET Payload = REPLICATE('B', 4100) WHERE Id = 2;\n\n-- Check page density\nSELECT index_level, page_count, avg_page_space_used_in_percent,\navg_fragmentation_in_percent, record_count,\nghost_record_count, version_ghost_record_count\nFROM sys.dm_db_index_physical_stats(DB_ID(), OBJECT_ID('dbo.SplitDemo'),1, NULL, 'SAMPLED')\nWHERE alloc_unit_type_desc = 'IN_ROW_DATA';<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"569\" height=\"46\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-17.png\" alt=\"\" class=\"wp-image-45967\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-17.png 569w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-17-300x24.png 300w\" sizes=\"auto, (max-width: 569px) 100vw, 569px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After the page split:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"118\" height=\"104\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-22.png\" alt=\"\" class=\"wp-image-45972\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Line 1 is located at page 376<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Line 2 is located at page 379<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Line 3 is located at page 378<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Line 4 is located at page 378<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"824\" height=\"360\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-20.png\" alt=\"\" class=\"wp-image-45970\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-20.png 824w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-20-300x131.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-20-768x336.png 768w\" sizes=\"auto, (max-width: 824px) 100vw, 824px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why does it cost so little today?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There is exactly one mechanism through which external fragmentation ever costed something: the read-ahead. During a scan, the engine prefetches pages with large I\/Os and an I\/O is a contiguous range of the file: one offset, one length, up to 512 KB. When the index is contiguous one I\/O brings back 64 pages. When it is not the same pages arrive in several smaller I\/Os.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When do these smaller I\/Os hurt ? Three conditions must be met at the same time:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The data is cold: a page already in the buffer pool generates no physical I\/O at all<\/li>\n\n\n\n<li>The operation is a large scan: a seek navigates the B-tree by page ID and does not care about the order<\/li>\n\n\n\n<li>Each additional I\/O has a price<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">On SSD, NVMe and cloud storage, an additional I\/O costs a few dozen microseconds and the physical placement below the file is arbitrary anyway (SSD controllers and SANs put the blocks wherever they want).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">External fragmentation survived its own usefulness for another reason: it was a good symptom. It increases because of page splits, and page splits destroy the page density and inflate the transaction log. For twenty years, we treated the thermometer because it was correlated with the disease. The disease was the density.<\/p>\n\n\n\n<h2 id=\"h-reference\" class=\"wp-block-heading\">Reference<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/relational-databases\/indexes\/automatic-index-compaction?view=fabric-sqldb\">Automatic Index Compaction &#8211; SQL Server | Microsoft Learn<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you. <a href=\"https:\/\/www.linkedin.com\/in\/amine-haloui-76968056\/\" data-type=\"link\" data-id=\"https:\/\/www.linkedin.com\/in\/amine-haloui-76968056\/\">Amine Haloui<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For years, we have all scheduled the same thing on our SQL Server environments: a nightly or weekly index maintenance job. We check the fragmentation level, we run a REORGANIZE between 5% and 30%, a REBUILD above 30% and we hope the job finishes before the business day starts. Microsoft recently released a new feature [&hellip;]<\/p>\n","protected":false},"author":147,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":"","_members_access_role":[],"_members_access_error":""},"categories":[3271,229,99],"tags":[1338,51],"type_dbi":[2881,2874],"class_list":["post-45961","post","type-post","status-publish","format-standard","hentry","category-azure","category-database-administration-monitoring","category-sql-server","tag-azure","tag-sql-server","type-azure","type-sql-server"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.0 (Yoast SEO v28.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>SQL Server: Automatic index compaction in Azure (preview) \u2013 Part 1 - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server: Automatic index compaction in Azure (preview) \u2013 Part 1\" \/>\n<meta property=\"og:description\" content=\"For years, we have all scheduled the same thing on our SQL Server environments: a nightly or weekly index maintenance job. We check the fragmentation level, we run a REORGANIZE between 5% and 30%, a REBUILD above 30% and we hope the job finishes before the business day starts. Microsoft recently released a new feature [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-28T23:46:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-29T00:04:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-26.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"740\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Amine Haloui\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Amine Haloui\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/\"},\"author\":{\"name\":\"Amine Haloui\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/221331d69d49c63fca67069b49b813fe\"},\"headline\":\"SQL Server: Automatic index compaction in Azure (preview) \u2013 Part 1\",\"datePublished\":\"2026-07-28T23:46:39+00:00\",\"dateModified\":\"2026-07-29T00:04:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/\"},\"wordCount\":1344,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2026\\\/07\\\/image-26.png\",\"keywords\":[\"Azure\",\"SQL Server\"],\"articleSection\":[\"Azure\",\"Database Administration &amp; Monitoring\",\"SQL Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/\",\"name\":\"SQL Server: Automatic index compaction in Azure (preview) \u2013 Part 1 - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2026\\\/07\\\/image-26.png\",\"datePublished\":\"2026-07-28T23:46:39+00:00\",\"dateModified\":\"2026-07-29T00:04:52+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/221331d69d49c63fca67069b49b813fe\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2026\\\/07\\\/image-26.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2026\\\/07\\\/image-26.png\",\"width\":960,\"height\":740},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-automatic-index-compaction-preview-part-1\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server: Automatic index compaction in Azure (preview) \u2013 Part 1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/221331d69d49c63fca67069b49b813fe\",\"name\":\"Amine Haloui\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/64707272207cd8d2667aefcb212f3ff5d19a15813da5aad6553f109d1f1afec1?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/64707272207cd8d2667aefcb212f3ff5d19a15813da5aad6553f109d1f1afec1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/64707272207cd8d2667aefcb212f3ff5d19a15813da5aad6553f109d1f1afec1?s=96&d=mm&r=g\",\"caption\":\"Amine Haloui\"},\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/aminehaloui\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Server: Automatic index compaction in Azure (preview) \u2013 Part 1 - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server: Automatic index compaction in Azure (preview) \u2013 Part 1","og_description":"For years, we have all scheduled the same thing on our SQL Server environments: a nightly or weekly index maintenance job. We check the fragmentation level, we run a REORGANIZE between 5% and 30%, a REBUILD above 30% and we hope the job finishes before the business day starts. Microsoft recently released a new feature [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/","og_site_name":"dbi Blog","article_published_time":"2026-07-28T23:46:39+00:00","article_modified_time":"2026-07-29T00:04:52+00:00","og_image":[{"width":960,"height":740,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-26.png","type":"image\/png"}],"author":"Amine Haloui","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Amine Haloui","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/"},"author":{"name":"Amine Haloui","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/221331d69d49c63fca67069b49b813fe"},"headline":"SQL Server: Automatic index compaction in Azure (preview) \u2013 Part 1","datePublished":"2026-07-28T23:46:39+00:00","dateModified":"2026-07-29T00:04:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/"},"wordCount":1344,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-26.png","keywords":["Azure","SQL Server"],"articleSection":["Azure","Database Administration &amp; Monitoring","SQL Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/","url":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/","name":"SQL Server: Automatic index compaction in Azure (preview) \u2013 Part 1 - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-26.png","datePublished":"2026-07-28T23:46:39+00:00","dateModified":"2026-07-29T00:04:52+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/221331d69d49c63fca67069b49b813fe"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-26.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2026\/07\/image-26.png","width":960,"height":740},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-automatic-index-compaction-preview-part-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL Server: Automatic index compaction in Azure (preview) \u2013 Part 1"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/221331d69d49c63fca67069b49b813fe","name":"Amine Haloui","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/64707272207cd8d2667aefcb212f3ff5d19a15813da5aad6553f109d1f1afec1?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/64707272207cd8d2667aefcb212f3ff5d19a15813da5aad6553f109d1f1afec1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/64707272207cd8d2667aefcb212f3ff5d19a15813da5aad6553f109d1f1afec1?s=96&d=mm&r=g","caption":"Amine Haloui"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/aminehaloui\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/45961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/147"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=45961"}],"version-history":[{"count":13,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/45961\/revisions"}],"predecessor-version":[{"id":46018,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/45961\/revisions\/46018"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=45961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=45961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=45961"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=45961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}