<?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>DECOMPRESS &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/decompress/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:35:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server 2016: New COMPRESS and DECOMPRESS function for the Column level Compression</title>
		<link>https://www.dbrnd.com/2017/11/sql-server-2016-new-compress-and-decompress-function-for-the-column-level-compression/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 06 Nov 2017 16:16:32 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[COMPRESS]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[DECOMPRESS]]></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=6109</guid>

					<description><![CDATA[SQL Server 2016 introduced the COMPRESS() and DECOMPRESS() function which we can use to compress column data of a table. The Compression of the column is not a good always and not a good for all the column. For that, there are different ways for compression. But we can use COMPRESS() on those columns which [&#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-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&amp;linkname=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" 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-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&amp;linkname=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" 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-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&amp;linkname=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" 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-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&amp;linkname=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" 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-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&amp;linkname=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" 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-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&amp;linkname=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" 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-2016-new-compress-and-decompress-function-for-the-column-level-compression%2F&#038;title=SQL%20Server%202016%3A%20New%20COMPRESS%20and%20DECOMPRESS%20function%20for%20the%20Column%20level%20Compression" data-a2a-url="https://www.dbrnd.com/2017/11/sql-server-2016-new-compress-and-decompress-function-for-the-column-level-compression/" data-a2a-title="SQL Server 2016: New COMPRESS and DECOMPRESS function for the Column level Compression"></a></p><p>SQL Server 2016 introduced the COMPRESS() and DECOMPRESS() function which we can use to compress column data of a table.</p>
<p>The Compression of the column is not a good always and not a good for all the column. For that, there are different ways for compression.</p>
<blockquote><p>But we can use COMPRESS() on those columns which size are very big and which are not most in use.<br />
The reason is, compressed column requires to be decompressed using DECOMPRESS() while selecting the data which will reduce query performance.</p></blockquote>
<p>If we are facing a size related problem, we can think for COMPRESS() on those big size columns which are not most in use.</p>
<p><strong>Please check the below demonstration on COMPRESS() and DECOMPRESS():</strong></p>
<p><strong>Create a sample table:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_DumpData
(
	ID INT 
	,RandomData NVARCHAR(MAX)
	,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,RandomData)
SELECT 
	ID
	,CONCAT(CAST(NEWID() AS NVARCHAR(MAX)), ' - I am follower of dbrnd.com') AS RandomData
FROM CTE 
OPTION (MAXRECURSION 0)
GO</pre><p>
<strong>Create a sample table to store Compressed Data:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_DumpData_Compressed
(
	ID INT 
	,RandomData NVARCHAR(MAX)
	,CONSTRAINT pk_tbl_DumpData_Compressed_ID PRIMARY KEY(ID)
)
GO</pre><p>
<strong>Insert Compressed data from the original table:</strong></p><pre class="crayon-plain-tag">INSERT INTO tbl_DumpData_Compressed
SELECT ID, COMPRESS (RandomData) AS RandomData
FROM tbl_DumpData</pre><p>
<strong>Compare the size of both table:</strong><br />
You will get to know that, compressed table size is smaller than original table</p><pre class="crayon-plain-tag">SP_Spaceused 'tbl_DumpData'
GO
SP_Spaceused 'tbl_DumpData_Compressed'
GO</pre><p>
<img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-6111" src="https://www.dbrnd.com/wp-content/uploads/2017/09/SQLCompressDecompress.png" alt="SQL Compress Decompress" width="506" height="115" /></p>
<p><strong>Now, do DECOMPRESS and select your data:</strong><br />
<pre class="crayon-plain-tag">SELECT
	ID
	,CAST(DECOMPRESS(RandomData) AS NVARCHAR(MAX)) AS RandomData 
FROM tbl_DumpData_Compressed</pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
