<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Data Compression on Andy M Mallon - AM²</title><link>https://am2.co/category/data-compression/</link><description>Recent content in Data Compression on Andy M Mallon - AM²</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Tue, 17 Dec 2019 10:55:26 -0500</lastBuildDate><atom:link href="https://am2.co/category/data-compression/index.xml" rel="self" type="application/rss+xml"/><item><title>I hate sp_estimate_data_compression_savings</title><link>https://am2.co/2019/12/17/i-hate-sp_estimate_data_compression_savings/</link><pubDate>Tue, 17 Dec 2019 10:55:26 -0500</pubDate><guid>https://am2.co/2019/12/17/i-hate-sp_estimate_data_compression_savings/</guid><description>&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=-fQGPZTECYs" rel="noopener noreferrer" target="_blank"&gt;&lt;img src="https://am2.co/wp-content/uploads/Slinky-1024x1024.jpg" alt="" width="400" height="400" class="alignright size-large wp-image-2380" /&gt;&lt;/a&gt;&#10;If you&amp;rsquo;re working with compressed indexes, SQL Server provides &lt;a href="https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-estimate-data-compression-savings-transact-sql?view=sql-server-ver15" rel="noopener noreferrer" target="_blank"&gt;a system stored procedure&lt;/a&gt; to help test the space savings of implementing data compression: &lt;code&gt;sp_estimate_data_compression_savings&lt;/code&gt;. Starting in SQL Server 2019, &lt;a href="http://www.nikoport.com/2018/09/27/columnstore-indexes-part-125-estimate-columnstore-compression-as-a-system-stored-proc/" rel="noopener noreferrer" target="_blank"&gt;it can even be used to estimate savings with columnstore&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;I really don&amp;rsquo;t like &lt;code&gt;sp_estimate_data_compression_savings&lt;/code&gt;. In fact, I kind of hate it. It&amp;rsquo;s not always very accurate&amp;ndash;and even when it is accurate, the results can be misleading. Before I get ranty about why I don&amp;rsquo;t like it, let&amp;rsquo;s look at it in action.&lt;/p&gt;</description></item><item><title>Changing a column from int to bigint, without downtime</title><link>https://am2.co/2019/12/11/changing-a-column-from-int-to-bigint-without-downtime/</link><pubDate>Wed, 11 Dec 2019 08:00:41 -0500</pubDate><guid>https://am2.co/2019/12/11/changing-a-column-from-int-to-bigint-without-downtime/</guid><description>&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=YHKGUu2gaOg" rel="noopener noreferrer" target="_blank"&gt;&lt;img src="https://am2.co/wp-content/uploads/AlterOnline2.png" alt="" width="481" height="396" class="alignright size-full wp-image-2359" /&gt;&lt;/a&gt;&#10;Changing a column from &lt;code&gt;int&lt;/code&gt; to &lt;code&gt;bigint&lt;/code&gt; has gotten a lot easier since I started working on SQL Server back at the turn of the century. SQL Server 2016 introduced the ability to do &lt;code&gt;ALTER TABLE...ALTER COLUMN&lt;/code&gt; as an online operation using the &lt;code&gt;WITH (ONLINE=ON)&lt;/code&gt; syntax in Enterprise Edition. This wonderful syntax now allows you to alter a column from &lt;code&gt;int&lt;/code&gt; to &lt;code&gt;bigint&lt;/code&gt; without causing major blocking. The &lt;code&gt;int&lt;/code&gt; to &lt;code&gt;bigint&lt;/code&gt; conversion is one of the most popular data type changes I see&amp;ndash;A developer inevitably creates the table thinking they will never have more than 2 billion rows&amp;hellip; then some years or months later 2 billion becomes a reality.&lt;/p&gt;</description></item><item><title>What is the row overhead when using Page Compression?</title><link>https://am2.co/2017/04/28/what-is-the-row-overhead-when-using-page-compression/</link><pubDate>Fri, 28 Apr 2017 11:23:41 -0400</pubDate><guid>https://am2.co/2017/04/28/what-is-the-row-overhead-when-using-page-compression/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/172252/52344"&gt;&lt;img src="https://am2.co/wp-content/uploads/blockquote.png" alt="clip art of &#10;a double-quote character" width="100" height="75" class="alignleft size-full wp-image-55062" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;I have created a table with 650 &lt;code&gt;Numeric(19,4)&lt;/code&gt; columns.&#10;When I switch on Page Compression, by running&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sql" data-lang="sql"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;TABLE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;fct&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MyTable&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;REBUILD&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;WITH&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DATA_COMPRESSION&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;PAGE&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I get &lt;/p&gt;&#10;&lt;div class="errorMsg"&gt;&#10; &lt;p&gt;Msg 1975, Level 16, State 1&lt;br&gt;Index 'PK_Mytable' row length exceeds the maximum permissible length of '8060' bytes. &lt;/p&gt;&#10;&lt;/div&gt;</description></item><item><title>T-SQL Tuesday #79 - COMPRESS()ing LOB data</title><link>https://am2.co/2016/06/14/t-sql-tuesday-79/</link><pubDate>Tue, 14 Jun 2016 09:00:25 -0400</pubDate><guid>https://am2.co/2016/06/14/t-sql-tuesday-79/</guid><description>&lt;img class="alignright wp-image-532 size-full" src="https://am2.co/wp-content/uploads/TSQL2SDAY-300x300.png" width="300" height="300" /&gt;&#10;&lt;blockquote&gt;It’s T-SQL Tuesday,  the blog party that SQL Server expert &lt;strong&gt;Adam Machanic&lt;/strong&gt; (&lt;a href="http://dataeducation.com/blog/" target="_blank" rel="noopener"&gt;blog&lt;/a&gt;|t&lt;a href="http://twitter.com/adammachanic" target="_blank" rel="noopener"&gt;witter&lt;/a&gt;) started. This month’s episode is hosted by &lt;strong&gt;Michael J Swart&lt;/strong&gt; (&lt;a href="http://michaeljswart.com/" target="_blank" rel="noopener"&gt;blog&lt;/a&gt;| &lt;a href="https://twitter.com/mjswart" target="_blank" rel="noopener"&gt;twitter&lt;/a&gt;). The topic: &lt;strong&gt;&lt;a href="http://michaeljswart.com/2016/06/t-sql-tuesday-079-its-2016/" target="_blank" rel="noopener"&gt;SQL Server 2016 is out!&lt;/a&gt;&lt;/strong&gt;&lt;/blockquote&gt;&#10;SQL Server 2016 is hot off the presses, and Michael challenges us to blog about it.&#10;&lt;p&gt;I&amp;rsquo;ve been using SSMS 2016 (I&amp;rsquo;m impressed!), but I haven&amp;rsquo;t spent tons of time using the server-side bits. As I type this intro, the 2016 installer is chugging along getting a fresh instance ready for me to explore so I can write about&amp;hellip;&lt;/p&gt;</description></item><item><title>Data Compression: How page compression works</title><link>https://am2.co/2016/02/22/data-compression-how-page-works/</link><pubDate>Mon, 22 Feb 2016 10:00:59 -0500</pubDate><guid>https://am2.co/2016/02/22/data-compression-how-page-works/</guid><description>&lt;p&gt;SQL Server supports two kinds of data compression on rowstore data. Columnstore compression is for a different day. You can compress heaps, clustered indexes (on both tables and views), and nonclustered indexes (on both tables and views).&lt;/p&gt;&#10;&lt;h3 id="compression-requirements"&gt;Compression requirements&lt;/h3&gt;&#10;&lt;p&gt;Data compression is available in SQL Server 2008 &amp;amp; newer. It was introduced as an Enterprise Edition feature&amp;ndash;if you were using Standard Edition or Express, then you were out of luck. Starting with SQL Server 2016 SP1 (thus all currently-supported versions), data compression is available across all Editions. There are &lt;a href="https://am2.co/2015/12/29/data-compression-costs-benefits/"&gt;benefits &amp;amp; costs to using data compression&lt;/a&gt;&amp;ndash;as with anything, make sure you understand it before you implement it.&lt;/p&gt;</description></item><item><title>Data Compression: How row compression works</title><link>https://am2.co/2016/02/15/data-compression-how-row-works/</link><pubDate>Mon, 15 Feb 2016 10:07:29 -0500</pubDate><guid>https://am2.co/2016/02/15/data-compression-how-row-works/</guid><description>&lt;p&gt;SQL Server supports two kinds of data compression on rowstore data. Columnstore compression is for a different day. You can compress heaps, clustered indexes (on both tables and views), and nonclustered indexes (on both tables and views).&lt;/p&gt;&#10;&lt;h3 id="compression-requirements"&gt;Compression requirements&lt;/h3&gt;&#10;&lt;p&gt;Data compression is available in SQL Server 2008 &amp;amp; newer. It is an Enterprise Edition feature&amp;ndash;if you&amp;rsquo;re using Standard Edition or Express, then you&amp;rsquo;re out of luck. There are &lt;a href="https://am2.co/2015/12/29/data-compression-costs-benefits/"&gt;benefits &amp;amp; costs to using data compression&lt;/a&gt;&amp;ndash;as with anything, make sure you understand it before you implement it.&lt;/p&gt;</description></item><item><title>Data Compression: Costs &amp; benefits</title><link>https://am2.co/2015/12/29/data-compression-costs-benefits/</link><pubDate>Tue, 29 Dec 2015 15:00:56 -0500</pubDate><guid>https://am2.co/2015/12/29/data-compression-costs-benefits/</guid><description>&lt;p&gt;SQL Server supports two kinds of data compression on rowstore data. Columnstore compression is for a different day. You can compress heaps, clustered indexes (on both tables and views), and nonclustered indexes (on both tables and views).&lt;/p&gt;&#10;&lt;h3 id="compression-requirements"&gt;Compression requirements&lt;/h3&gt;&#10;&lt;p&gt;Data compression is available in SQL Server 2008 &amp;amp; newer. It is an Enterprise Edition feature&amp;ndash;if you&amp;rsquo;re using Standard Edition or Express, then you&amp;rsquo;re out of luck.&lt;/p&gt;</description></item></channel></rss>