<?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>sp_estimate_data_compression_savings &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/sp_estimate_data_compression_savings/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>Thu, 14 Sep 2017 10:33:29 +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 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 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="(max-width: 843px) 100vw, 843px" /></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Use sp_estimate_data_compression_savings for checking estimate object size and saving space</title>
		<link>https://www.dbrnd.com/2017/09/sql-server-use-sp_estimate_data_compression_savings-for-checking-estimate-object-size-and-saving-space/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 14 Sep 2017 16:16:19 +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[sp_estimate_data_compression_savings]]></category>
		<category><![CDATA[space saving]]></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=6083</guid>

					<description><![CDATA[In this post, I am sharing the use of sp_estimate_data_compression_savings system stored procedure which we can use to check the object size + object expected saving space in SQL Server. Many times, I have found that people are using CHAR data type for fix length store, but it is also true that people are not [&#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-use-sp_estimate_data_compression_savings-for-checking-estimate-object-size-and-saving-space%2F&amp;linkname=SQL%20Server%3A%20Use%20sp_estimate_data_compression_savings%20for%20checking%20estimate%20object%20size%20and%20saving%20space" 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-use-sp_estimate_data_compression_savings-for-checking-estimate-object-size-and-saving-space%2F&amp;linkname=SQL%20Server%3A%20Use%20sp_estimate_data_compression_savings%20for%20checking%20estimate%20object%20size%20and%20saving%20space" 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-use-sp_estimate_data_compression_savings-for-checking-estimate-object-size-and-saving-space%2F&amp;linkname=SQL%20Server%3A%20Use%20sp_estimate_data_compression_savings%20for%20checking%20estimate%20object%20size%20and%20saving%20space" 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-use-sp_estimate_data_compression_savings-for-checking-estimate-object-size-and-saving-space%2F&amp;linkname=SQL%20Server%3A%20Use%20sp_estimate_data_compression_savings%20for%20checking%20estimate%20object%20size%20and%20saving%20space" 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-use-sp_estimate_data_compression_savings-for-checking-estimate-object-size-and-saving-space%2F&amp;linkname=SQL%20Server%3A%20Use%20sp_estimate_data_compression_savings%20for%20checking%20estimate%20object%20size%20and%20saving%20space" 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-use-sp_estimate_data_compression_savings-for-checking-estimate-object-size-and-saving-space%2F&amp;linkname=SQL%20Server%3A%20Use%20sp_estimate_data_compression_savings%20for%20checking%20estimate%20object%20size%20and%20saving%20space" 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-use-sp_estimate_data_compression_savings-for-checking-estimate-object-size-and-saving-space%2F&#038;title=SQL%20Server%3A%20Use%20sp_estimate_data_compression_savings%20for%20checking%20estimate%20object%20size%20and%20saving%20space" data-a2a-url="https://www.dbrnd.com/2017/09/sql-server-use-sp_estimate_data_compression_savings-for-checking-estimate-object-size-and-saving-space/" data-a2a-title="SQL Server: Use sp_estimate_data_compression_savings for checking estimate object size and saving space"></a></p><p>In this post, I am sharing the use of sp_estimate_data_compression_savings system stored procedure which we can use to check the object size + object expected saving space in SQL Server.</p>
<p>Many times, I have found that people are using CHAR data type for fix length store, but it is also true that people are not storing a correct length of data in CHAR column.</p>
<p>I just gave one example of CHAR column; there might be many reasons where we have to check the table actual size and the size of saving space.</p>
<blockquote><p>Once we got the actual size and expected saving space, we can apply proper compression algorithm on objects. If your table has multiple indexes, you can compare space of all indexes and can take the decision to which index requires to compress.</p>
<p>We can use sp_estimate_data_compression_savings for the table of a clustered index, non-clustered index and heap table. You can also evaluate object for ROW size and PAGE SIZE.</p></blockquote>
<p><strong>Check the below small demonstration on this:</strong></p>
<p><strong>Create a sample table:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_DumpData
(
	ID INT 
	,RandomNumber BIGINT
	,CONSTRAINT pk_tbl_DumpData_ID PRIMARY KEY(ID)
)
GO</pre><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;= 1000000
)
INSERT INTO tbl_DumpData(ID,RandomNumber)
SELECT 
	ID
	,convert(int, convert (varbinary(4), NEWID(), 1)) AS RandomNumber
FROM CTE 
OPTION (MAXRECURSION 0)
GO</pre><p>
<strong>Check the inserted records:</strong></p><pre class="crayon-plain-tag">SELECT *
FROM tbl_DumpData</pre><p>
<strong>Check space for ROW:</strong></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 = 'ROW'</pre><p>
<p><strong>Result: Check the difference between size_with_current_compression_setting and size_with_requested_compression_setting</strong></p>
<p>After data compression, we can make the object size upto size_with_requested_compression_setting.</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-6086" src="https://www.dbrnd.com/wp-content/uploads/2017/08/SQLDataCompression.png" alt="SQL Data Compression" width="809" height="66" srcset="https://www.dbrnd.com/wp-content/uploads/2017/08/SQLDataCompression.png 809w, https://www.dbrnd.com/wp-content/uploads/2017/08/SQLDataCompression-679x55.png 679w" sizes="(max-width: 809px) 100vw, 809px" /></p>
<p><strong>Check space for PAGE:</strong></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><strong>Result: Check the difference between size_with_current_compression_setting and size_with_requested_compression_setting</strong></p>
<p>After data compression, we can make the object size upto size_with_requested_compression_setting.</p>
<p><img decoding="async" class="alignnone size-full wp-image-6087" src="https://www.dbrnd.com/wp-content/uploads/2017/08/SQLDataCompressionPage.png" alt="SQL Data Compression Page" width="820" height="63" srcset="https://www.dbrnd.com/wp-content/uploads/2017/08/SQLDataCompressionPage.png 820w, https://www.dbrnd.com/wp-content/uploads/2017/08/SQLDataCompressionPage-679x52.png 679w" sizes="(max-width: 820px) 100vw, 820px" /></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
