<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>REBUILD &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/rebuild/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Fri, 22 Sep 2017 20:41:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Server 2014: WAIT_AT_LOW_PRIORITY improved the performance of ONLINE REBUILD INDEX operation</title>
		<link>https://www.dbrnd.com/2017/11/sql-server-2014-wait_at_low_priority-improved-the-performance-of-online-rebuild-index-operation/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 12 Nov 2017 16:16:59 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[BLOCKER]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[MAX_DURATION]]></category>
		<category><![CDATA[REBUILD]]></category>
		<category><![CDATA[Rebuild Index]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2014]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[WAIT_AT_LOW_PRIORITY]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6113</guid>

					<description><![CDATA[SQL Server 2014 introduced WAIT_AT_LOW_PRIORITY option which enhanced the performance of ONLINE REBUILD INDEX. In the previous version of SQL Server, REBUILD INDEX had to wait for the running transaction. But now in SQL Server 2014, you can give options like MAX_DURATION in minutes, ABORT_AFTER_WAIT with different options. For ABORT_AFTER_WAIT, took the reference from Microsoft: [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-2014-wait_at_low_priority-improved-the-performance-of-online-rebuild-index-operation%2F&amp;linkname=SQL%20Server%202014%3A%20WAIT_AT_LOW_PRIORITY%20improved%20the%20performance%20of%20ONLINE%20REBUILD%20INDEX%20operation" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-2014-wait_at_low_priority-improved-the-performance-of-online-rebuild-index-operation%2F&amp;linkname=SQL%20Server%202014%3A%20WAIT_AT_LOW_PRIORITY%20improved%20the%20performance%20of%20ONLINE%20REBUILD%20INDEX%20operation" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-2014-wait_at_low_priority-improved-the-performance-of-online-rebuild-index-operation%2F&amp;linkname=SQL%20Server%202014%3A%20WAIT_AT_LOW_PRIORITY%20improved%20the%20performance%20of%20ONLINE%20REBUILD%20INDEX%20operation" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-2014-wait_at_low_priority-improved-the-performance-of-online-rebuild-index-operation%2F&amp;linkname=SQL%20Server%202014%3A%20WAIT_AT_LOW_PRIORITY%20improved%20the%20performance%20of%20ONLINE%20REBUILD%20INDEX%20operation" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-2014-wait_at_low_priority-improved-the-performance-of-online-rebuild-index-operation%2F&amp;linkname=SQL%20Server%202014%3A%20WAIT_AT_LOW_PRIORITY%20improved%20the%20performance%20of%20ONLINE%20REBUILD%20INDEX%20operation" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-2014-wait_at_low_priority-improved-the-performance-of-online-rebuild-index-operation%2F&amp;linkname=SQL%20Server%202014%3A%20WAIT_AT_LOW_PRIORITY%20improved%20the%20performance%20of%20ONLINE%20REBUILD%20INDEX%20operation" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-2014-wait_at_low_priority-improved-the-performance-of-online-rebuild-index-operation%2F&#038;title=SQL%20Server%202014%3A%20WAIT_AT_LOW_PRIORITY%20improved%20the%20performance%20of%20ONLINE%20REBUILD%20INDEX%20operation" data-a2a-url="https://www.dbrnd.com/2017/11/sql-server-2014-wait_at_low_priority-improved-the-performance-of-online-rebuild-index-operation/" data-a2a-title="SQL Server 2014: WAIT_AT_LOW_PRIORITY improved the performance of ONLINE REBUILD INDEX operation"></a></p><p>SQL Server 2014 introduced WAIT_AT_LOW_PRIORITY option which enhanced the performance of ONLINE REBUILD INDEX.</p>
<blockquote><p>In the previous version of SQL Server, REBUILD INDEX had to wait for the running transaction.<br />
But now in SQL Server 2014, you can give options like MAX_DURATION in minutes, ABORT_AFTER_WAIT with different options.</p></blockquote>
<p><a href="https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-index-transact-sql" target="_blank" rel="noopener noreferrer">For ABORT_AFTER_WAIT, took the reference from Microsoft:</a></p><pre class="crayon-plain-tag">ABORT_AFTER_WAIT = [NONE | SELF | BLOCKERS]</pre><p>
<strong>NONE:</strong> Continue waiting for the lock with normal (regular) priority.</p>
<p><strong>SELF:</strong> Exit the online index rebuild DDL operation currently being executed without taking any action.</p>
<p><strong>BLOCKERS:</strong> Kill all user transactions that block the online index rebuild DDL operation so that the operation can continue. The BLOCKERS option requires the login to have ALTER ANY CONNECTION permission.</p>
<p><strong>Please check the below demonstration, where I am comparing old and new approach of REBUILD INDEX:</strong></p>
<p><strong>Create a sample table:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_DumpData
(
	ID INT 
	,RandomID VARCHAR(MAX)
	,CONSTRAINT pk_tbl_DumpData_ID PRIMARY KEY(ID)
)
GO</pre><p>
<p><strong>Insert dummy data:</strong></p><pre class="crayon-plain-tag">;WITH CTE AS
(
	SELECT 1 ID
	UNION all
	SELECT ID + 1
	FROM CTE   
	WHERE ID + 1 &lt;= 100000
)
INSERT INTO tbl_DumpData(ID,RandomID)
SELECT 
	ID
	,NEWID() AS RandomID
FROM CTE 
OPTION (MAXRECURSION 0)
GO</pre><p>
<p><strong>Open new session/query window, execute below update:</strong></p><pre class="crayon-plain-tag">BEGIN TRANSACTION
UPDATE tbl_DumpData SET RandomID = 39840972340234 WHERE ID = 8</pre><p>
<p><strong>Jump to old session window, and execute below REBUILD:</strong><br />
<em>It is Running&#8230; Running&#8230; Running&#8230;, because table is locked by another transaction</em></p><pre class="crayon-plain-tag">ALTER INDEX pk_tbl_DumpData_ID ON tbl_DumpData REBUILD
WITH
(
   ONLINE = ON
)
GO</pre><p>
<p><strong>Check the lock table:</strong><br />
You can find that your REBUILD query is in WAIT mode.</p><pre class="crayon-plain-tag">SELECT *FROM sys.dm_tran_locks</pre><p>
<img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-6115" src="https://www.dbrnd.com/wp-content/uploads/2017/09/SQLIndexLock.png" alt="SQL Index Lock" width="740" height="136" srcset="https://www.dbrnd.com/wp-content/uploads/2017/09/SQLIndexLock.png 740w, https://www.dbrnd.com/wp-content/uploads/2017/09/SQLIndexLock-679x125.png 679w" sizes="(max-width: 740px) 100vw, 740px" /></p>
<p><strong>Now stop the execution of the previous REBUILD, and execute below REBUILD WITH WAIT_AT_LOW_PRIORITY:</strong><br />
Set MAX_DURATION for one minute and ABORT_AFTER_WAIT type is SELF.<br />
<pre class="crayon-plain-tag">ALTER INDEX pk_tbl_DumpData_ID ON tbl_DumpData REBUILD
WITH
(
   ONLINE = ON
   (
	WAIT_AT_LOW_PRIORITY 
	(
		MAX_DURATION = 1
		,ABORT_AFTER_WAIT = SELF
	)
   )
)
GO</pre>
<p><strong>Above REBUILD will wait for One minute and then it will throw an error message:</strong><br />
<pre class="crayon-plain-tag">Msg 1222, Level 16, State 56, Line 1
Lock request time out period exceeded.</pre>
<p><strong>Now, test with BLOCKER option:</strong><br />
It will wait for one minute, and then it will kill the open UPDATE transaction to finish the REBUILD operation.<br />
<pre class="crayon-plain-tag">ALTER INDEX pk_tbl_DumpData_ID ON tbl_DumpData REBUILD
WITH
(
   ONLINE = ON
   (
	WAIT_AT_LOW_PRIORITY 
	(
		MAX_DURATION = 1
		,ABORT_AFTER_WAIT = BLOCKERS 
	)
   )
)
GO</pre>
<p><strong>Now, go to another transaction where UPDATE transaction was there:</strong><br />
Try to execute any query, you will get below error message because this session is terminated by REBUILD + BLOCKERS.<br />
<pre class="crayon-plain-tag">SELECT *FROM tbl_DumpData</pre>
<p><strong>Error:</strong><br />
<pre class="crayon-plain-tag">Msg 0, Level 20, State 0, Line 0
The connection is broken and recovery is not possible.  The connection is marked by the server as unrecoverable.  No attempt was made to restore the connection.</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: How to Remove Forwarded Records of a Heap Table?</title>
		<link>https://www.dbrnd.com/2017/11/sql-server-how-to-remove-forwarded-records-of-a-heap-table/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 04 Nov 2017 16:16:13 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Forwarded Record]]></category>
		<category><![CDATA[fragmentation]]></category>
		<category><![CDATA[heap table]]></category>
		<category><![CDATA[REBUILD]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6304</guid>

					<description><![CDATA[In the previous two posts, I shared basic about Forwarding Records of Heap Table and shared a script to find the count of Forwarded Records in SQL Server. In this post, I am sharing a practical demonstration on Forwarding Records like generate Forwarding Records and then Remove those Forwarding Records. Please check the below full [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-how-to-remove-forwarded-records-of-a-heap-table%2F&amp;linkname=SQL%20Server%3A%20How%20to%20Remove%20Forwarded%20Records%20of%20a%20Heap%20Table%3F" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-how-to-remove-forwarded-records-of-a-heap-table%2F&amp;linkname=SQL%20Server%3A%20How%20to%20Remove%20Forwarded%20Records%20of%20a%20Heap%20Table%3F" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-how-to-remove-forwarded-records-of-a-heap-table%2F&amp;linkname=SQL%20Server%3A%20How%20to%20Remove%20Forwarded%20Records%20of%20a%20Heap%20Table%3F" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-how-to-remove-forwarded-records-of-a-heap-table%2F&amp;linkname=SQL%20Server%3A%20How%20to%20Remove%20Forwarded%20Records%20of%20a%20Heap%20Table%3F" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-how-to-remove-forwarded-records-of-a-heap-table%2F&amp;linkname=SQL%20Server%3A%20How%20to%20Remove%20Forwarded%20Records%20of%20a%20Heap%20Table%3F" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-how-to-remove-forwarded-records-of-a-heap-table%2F&amp;linkname=SQL%20Server%3A%20How%20to%20Remove%20Forwarded%20Records%20of%20a%20Heap%20Table%3F" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F11%2Fsql-server-how-to-remove-forwarded-records-of-a-heap-table%2F&#038;title=SQL%20Server%3A%20How%20to%20Remove%20Forwarded%20Records%20of%20a%20Heap%20Table%3F" data-a2a-url="https://www.dbrnd.com/2017/11/sql-server-how-to-remove-forwarded-records-of-a-heap-table/" data-a2a-title="SQL Server: How to Remove Forwarded Records of a Heap Table?"></a></p><p>In the previous two posts, I shared basic about Forwarding Records of Heap Table and shared a script to find the count of Forwarded Records in SQL Server.</p>
<p>In this post, I am sharing a practical demonstration on Forwarding Records like generate Forwarding Records and then Remove those Forwarding Records.</p>
<p><strong>Please check the below full demonstration:</strong></p>
<p><strong>Create a sample HEAP table:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_Heap
(
	Col1 INT IDENTITY(1,1)
	,Col2 VARCHAR(1000)	
)
GO</pre><p>
<strong>Insert sample records with VARCHAR(5) size:</strong></p><pre class="crayon-plain-tag">INSERT INTO tbl_Heap (Col2) VALUES
('dbrnd')
GO 1000</pre><p>
<strong>Now, Update the data from VARCHAR(5) to VARCHAR(31):</strong></p><pre class="crayon-plain-tag">UPDATE tbl_Heap
SET Col2 = 'Database Research &amp; Development'
GO</pre><p>
<strong>Check the count of Forwarding Records:</strong></p>
<p><img decoding="async" class="alignnone size-full wp-image-6307" src="https://www.dbrnd.com/wp-content/uploads/2017/09/SQL-Server-Forwarded-Records.png" alt="" width="718" height="43" srcset="https://www.dbrnd.com/wp-content/uploads/2017/09/SQL-Server-Forwarded-Records.png 718w, https://www.dbrnd.com/wp-content/uploads/2017/09/SQL-Server-Forwarded-Records-679x41.png 679w" sizes="(max-width: 718px) 100vw, 718px" /></p>
<p><strong>For removing Forwarding Records, we should REBUILD the table:</strong></p><pre class="crayon-plain-tag">ALTER TABLE tbl_Heap REBUILD
GO</pre><p>
<strong>Now, Check the new count of Forwarding Records:</strong><br />
The count is 0 now.</p>
<p><img decoding="async" class="alignnone size-full wp-image-6308" src="https://www.dbrnd.com/wp-content/uploads/2017/09/SQL-Server-Forwarded-Records-Count.png" alt="" width="753" height="45" srcset="https://www.dbrnd.com/wp-content/uploads/2017/09/SQL-Server-Forwarded-Records-Count.png 753w, https://www.dbrnd.com/wp-content/uploads/2017/09/SQL-Server-Forwarded-Records-Count-679x41.png 679w" sizes="(max-width: 753px) 100vw, 753px" /></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server 2016: Introduced Data Compression Algorithm to reduce the size of Table</title>
		<link>https://www.dbrnd.com/2017/09/sql-server-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 15 Sep 2017 16:16:34 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[DATA_COMPRESSION]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[REBUILD]]></category>
		<category><![CDATA[sp_estimate_data_compression_savings]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2016]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6089</guid>

					<description><![CDATA[To complete this article, you must visit my yesterday&#8217;s post where I explained about the use of sp_estimate_data_compression_savings system stored procedure of SQL Server. In this post, I continue my demonstration and am using the same example of a table from the previous post. SQL Server 2016 introduced the Data Compression algorithm for compressing or [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&amp;linkname=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F09%2Fsql-server-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression%2F&#038;title=SQL%20Server%202016%3A%20Introduced%20Data%20Compression%20Algorithm%20to%20reduce%20the%20size%20of%20Table" data-a2a-url="https://www.dbrnd.com/2017/09/sql-server-2016-introduced-data-compression-algorithm-to-reduce-the-size-of-table-data_compression/" data-a2a-title="SQL Server 2016: Introduced Data Compression Algorithm to reduce the size of Table"></a></p><p>To complete this article, you must visit my yesterday&#8217;s post where I explained about the use of sp_estimate_data_compression_savings system stored procedure of SQL Server.</p>
<p>In this post, I continue my demonstration and am using the same example of a table from the previous post. SQL Server 2016 introduced the Data Compression algorithm for compressing or reducing the size of an object.</p>
<p><a href="https://docs.microsoft.com/en-us/sql/relational-databases/data-compression/data-compression" target="_blank" rel="noopener noreferrer">For more detail &#8211; visit this official LINK.</a></p>
<p>In this previous post, We can see 40% space that we can reduce of a tbl_Dumpdata table.</p>
<p><strong>How? </strong></p>
<blockquote><p>I created a clustered index on that table, so for data compression, we have to REBUILD that index with option DATA_COMPRESSION.</p></blockquote>
<p><strong>Rebuild Index with DATA_COMPRESSION:</strong></p><pre class="crayon-plain-tag">ALTER INDEX pk_tbl_DumpData_ID 
ON dbo.tbl_DumpData
REBUILD PARTITION = ALL 
WITH (DATA_COMPRESSION = PAGE)
GO</pre><p>
<strong>Now, check the space for PAGE option:</strong><br />
Check the below result, you can find the same value of column size_with_current_compression_setting and size_with_requested_compression_setting.</p><pre class="crayon-plain-tag">EXEC sp_estimate_data_compression_savings 
    @schema_name = 'dbo', 
    @object_name = 'tbl_DumpData', 
    @index_id = NULL, 
    @partition_number = NULL, 
    @data_compression = 'PAGE'</pre><p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6091" src="https://www.dbrnd.com/wp-content/uploads/2017/08/SQLDataCompressionPageRebuild.png" alt="SQLData Compression Page Rebuild" width="843" height="42" srcset="https://www.dbrnd.com/wp-content/uploads/2017/08/SQLDataCompressionPageRebuild.png 843w, https://www.dbrnd.com/wp-content/uploads/2017/08/SQLDataCompressionPageRebuild-679x34.png 679w" sizes="auto, (max-width: 843px) 100vw, 843px" /></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
