{"id":17468,"date":"2023-01-23T07:00:00","date_gmt":"2023-01-23T06:00:00","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/?p=17468"},"modified":"2023-01-23T07:00:00","modified_gmt":"2023-01-23T06:00:00","slug":"heap-deallocation-indexoptimize","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/","title":{"rendered":"SQL Server: Heap page deallocation and IndexOptimize"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-introduction\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">HEAP tables are a type of data structure that, unlike a clustered index table, does not have a specific ordering of its rows, making them faster to insert and delete data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They are often used for temporary &#8220;staging&#8221; tables.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is all fine. But, if your table is never dropped and reused over time for data loading, you need to be aware of how SQL Server manages HEAPs pages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I recently was asked by a customer why a HEAP table would consume significantly more disk space than the same table with a clustered index. Do you have any idea why?&#8221;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-heap-page-deallocation\">HEAP page deallocation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Well, SQL Server does not deallocate pages when doing a DELETE on a Heap. When a row is deleted, it does not mark the space as reusable, as a result, the space remains allocated and consumes more disk space.<br>This may seem surprising but it is documented in Microsoft Docs.<br>See: <a href=\"https:\/\/docs.microsoft.com\/en-US\/troubleshoot\/sql\/admin\/space-table-uses-not-released\" target=\"_blank\" rel=\"noreferrer noopener\">Space that a table uses is not completely released after you use a DELETE statement to delete data from the table in SQL Server<\/a><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">After you use a DELETE statement in Microsoft SQL Server to delete data from a table, you may notice that the space that the table uses is not completely released.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">There&#8217;s also a great article by Paul Randal on the topic: <br><a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/sqlskills-sql101-why-does-my-heap-have-a-bunch-of-empty-pages\/\" target=\"_blank\" rel=\"noreferrer noopener\">SQLskills SQL101: Why does my heap have a bunch of empty pages?<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The table I was asked about is a heap table with a size of approximately 130GB. This table experiences a high volume of data modification, with almost the entire table being deleted and inserted again on a daily basis. <br>In this specific scenario, the best workaround would be to perform a TRUNCATE statement on the table prior to data loading, as this would clear out any unused pages and release the space back to the operating system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Another workaround that is not mentioned in the documentation is to perform index maintenance periodically on the HEAP with a table REBUILD, this will defragment the heap and make the space more contiguous, as well as release any unused space back to the operating system.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-indexoptimize-and-heap-fragmentation\">IndexOptimize and HEAP fragmentation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Ola Hallengren maintenance script is a widely-used open-source solution for maintaining the performance and integrity of SQL Server databases. One of the features of the script is its ability to rebuild indexes to fix fragmentation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, the script does not include any specific functionality for rebuilding heaps or fixing heap fragmentation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It has been two years since an <a href=\"https:\/\/github.com\/olahallengren\/sql-server-maintenance-solution\/issues\/48\">issue<\/a> was opened on GitHub for this feature, and we are still waiting for it to be implemented.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-heap-empty-pages-and-indexoptimize-demo\">Heap empty pages and IndexOptimize demo<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Here is an example of creating a HEAP table with 3000 empty and unallocated pages. Running the indexOptimize procedure will not address this table, and therefore will not release this unused space.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>use master\ngo\nDROP DATABASE IF EXISTS Heapo;\nCREATE DATABASE Heapo;\nGO\n\nUSE Heapo;\nGO\nCREATE TABLE HeapTest (\n\t&#091;c1] INT IDENTITY\n\t, &#091;c2] VARCHAR(4000) DEFAULT replicate('a', 4000)\n\t, &#091;c3] VARCHAR(4000) DEFAULT ''\n);\nGO\n\n-- Insert 3000 rows, which will allocate 1500 pages\nINSERT INTO HeapTest DEFAULT VALUES;\nGO 3000<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this table, we can observe that there are 3000 rows with 1500 pages.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT &#091;page_count], &#091;record_count], &#091;avg_page_space_used_in_percent]\nFROM sys.dm_db_index_physical_stats (DB_ID (N'Heapo'), OBJECT_ID (N'HeapTest'), 0,  DEFAULT, 'DETAILED');\nGO<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"504\" height=\"57\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/1.jpg\" alt=\"\" class=\"wp-image-21887\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/1.jpg 504w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/1-300x34.jpg 300w\" sizes=\"auto, (max-width: 504px) 100vw, 504px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s delete all the rows.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Delete all the rows\nDELETE FROM HeapTest;\nGO<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Rows are still allocated:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"503\" height=\"58\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/2.jpg\" alt=\"\" class=\"wp-image-21889\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/2.jpg 503w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/2-300x35.jpg 300w\" sizes=\"auto, (max-width: 503px) 100vw, 503px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Now, what happens if we run Ola Hallengren&#8217;s index maintenance script.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>exec master.dbo.IndexOptimize @Databases = 'Heapo'<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"503\" height=\"58\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/2.jpg\" alt=\"\" class=\"wp-image-21889\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/2.jpg 503w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/2-300x35.jpg 300w\" sizes=\"auto, (max-width: 503px) 100vw, 503px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Same things. IndexOptimize does not do anything about HEAPs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rebuilding the index will release the unused pages.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER TABLE HeapTest REBUILD<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"508\" height=\"54\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/3.jpg\" alt=\"\" class=\"wp-image-21890\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/3.jpg 508w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/3-300x32.jpg 300w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">HEAP tables in SQL Server are a powerful data structure that can be used to store temporary data or large volumes of data that are inserted, updated, and deleted frequently. <br>However, it is important for DBAs to be aware of the issues with deallocations and to manually address HEAP issues as needed. <br>One strategy is to periodically rebuild the HEAPs using the ALTER TABLE \u2026 REBUILD command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Written by <a href=\"https:\/\/www.linkedin.com\/in\/steven-naudet-aa540158\/\">Steven Naudet<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction HEAP tables are a type of data structure that, unlike a clustered index table, does not have a specific ordering of its rows, making them faster to insert and delete data. They are often used for temporary &#8220;staging&#8221; tables. This is all fine. But, if your table is never dropped and reused over time&hellip;&nbsp;<\/p>\n","protected":false},"author":26,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[4133,99],"tags":[91],"class_list":["post-17468","post","type-post","status-publish","format-standard","category-database","category-sql-server","tag-index"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.9 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>SQL Server: Heap page deallocation and IndexOptimize - dbi services 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\/heap-deallocation-indexoptimize\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server: Heap page deallocation and IndexOptimize\" \/>\n<meta property=\"og:description\" content=\"Introduction HEAP tables are a type of data structure that, unlike a clustered index table, does not have a specific ordering of its rows, making them faster to insert and delete data. They are often used for temporary &#8220;staging&#8221; tables. This is all fine. But, if your table is never dropped and reused over time&hellip;&nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi services Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/dbiservices\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-23T06:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"504\" \/>\n\t<meta property=\"og:image:height\" content=\"57\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Microsoft Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:site\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Microsoft Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 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\\\/heap-deallocation-indexoptimize\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/heap-deallocation-indexoptimize\\\/\"},\"author\":{\"name\":\"Microsoft Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/857c83b2f1d7d3e7c113ed40edf63294\"},\"headline\":\"SQL Server: Heap page deallocation and IndexOptimize\",\"datePublished\":\"2023-01-23T06:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/heap-deallocation-indexoptimize\\\/\"},\"wordCount\":602,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/heap-deallocation-indexoptimize\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/1.jpg\",\"keywords\":[\"index\"],\"articleSection\":[\"Database\",\"SQL Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/heap-deallocation-indexoptimize\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/heap-deallocation-indexoptimize\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/heap-deallocation-indexoptimize\\\/\",\"name\":\"SQL Server: Heap page deallocation and IndexOptimize - dbi services Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/heap-deallocation-indexoptimize\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/heap-deallocation-indexoptimize\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/1.jpg\",\"datePublished\":\"2023-01-23T06:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/heap-deallocation-indexoptimize\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/heap-deallocation-indexoptimize\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/heap-deallocation-indexoptimize\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/1.jpg\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/1.jpg\",\"width\":504,\"height\":57},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/heap-deallocation-indexoptimize\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server: Heap page deallocation and IndexOptimize\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi services Blog\",\"description\":\"#BeSharing\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"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\":\"Organization\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\",\"name\":\"dbi services\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"width\":512,\"height\":512,\"caption\":\"dbi services\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/dbiservices\\\/\",\"https:\\\/\\\/x.com\\\/dbiservices\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/dbi-services\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/dbiservices\"],\"description\":\"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.\",\"email\":\"info@dbi-services.com\",\"telephone\":\"+41 32 422 96 00\",\"legalName\":\"dbi services SA\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/857c83b2f1d7d3e7c113ed40edf63294\",\"name\":\"Microsoft Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/microsoft-square.png\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/microsoft-square.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/microsoft-square.png\",\"caption\":\"Microsoft Team\"},\"description\":\"Posts published under the Microsoft Team account are collective contributions by the dbi services Microsoft consultants. The practice covers SQL Server across its lifecycle, from installation, migration, and security to high availability with Always On and performance tuning, together with Azure data services and the Microsoft Business Intelligence stack, including Power BI. The team holds Microsoft certifications up to Expert level and operates customer platforms under service level agreements.\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/microsoft-team\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Server: Heap page deallocation and IndexOptimize - dbi services 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\/heap-deallocation-indexoptimize\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server: Heap page deallocation and IndexOptimize","og_description":"Introduction HEAP tables are a type of data structure that, unlike a clustered index table, does not have a specific ordering of its rows, making them faster to insert and delete data. They are often used for temporary &#8220;staging&#8221; tables. This is all fine. But, if your table is never dropped and reused over time&hellip;&nbsp;","og_url":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/","og_site_name":"dbi services Blog","article_publisher":"https:\/\/www.facebook.com\/dbiservices\/","article_published_time":"2023-01-23T06:00:00+00:00","og_image":[{"width":504,"height":57,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/1.jpg","type":"image\/jpeg"}],"author":"Microsoft Team","twitter_card":"summary_large_image","twitter_creator":"@dbiservices","twitter_site":"@dbiservices","twitter_misc":{"Written by":"Microsoft Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/"},"author":{"name":"Microsoft Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/857c83b2f1d7d3e7c113ed40edf63294"},"headline":"SQL Server: Heap page deallocation and IndexOptimize","datePublished":"2023-01-23T06:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/"},"wordCount":602,"commentCount":0,"publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/1.jpg","keywords":["index"],"articleSection":["Database","SQL Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/","url":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/","name":"SQL Server: Heap page deallocation and IndexOptimize - dbi services Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/1.jpg","datePublished":"2023-01-23T06:00:00+00:00","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/1.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/01\/1.jpg","width":504,"height":57},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/heap-deallocation-indexoptimize\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL Server: Heap page deallocation and IndexOptimize"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi services Blog","description":"#BeSharing","publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"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":"Organization","@id":"https:\/\/www.dbi-services.com\/#organization","name":"dbi services","url":"https:\/\/www.dbi-services.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","width":512,"height":512,"caption":"dbi services"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/dbiservices\/","https:\/\/x.com\/dbiservices","https:\/\/www.linkedin.com\/company\/dbi-services\/","https:\/\/www.youtube.com\/user\/dbiservices"],"description":"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.","email":"info@dbi-services.com","telephone":"+41 32 422 96 00","legalName":"dbi services SA"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/857c83b2f1d7d3e7c113ed40edf63294","name":"Microsoft Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/12\/microsoft-square.png","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/12\/microsoft-square.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/12\/microsoft-square.png","caption":"Microsoft Team"},"description":"Posts published under the Microsoft Team account are collective contributions by the dbi services Microsoft consultants. The practice covers SQL Server across its lifecycle, from installation, migration, and security to high availability with Always On and performance tuning, together with Azure data services and the Microsoft Business Intelligence stack, including Power BI. The team holds Microsoft certifications up to Expert level and operates customer platforms under service level agreements.","url":"https:\/\/www.dbi-services.com\/blog\/author\/microsoft-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17468","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\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=17468"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17468\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=17468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=17468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=17468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}