<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Don&#8217;t Touch that Shrink Button!</title>
	<atom:link href="http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/</link>
	<description>Mike Walsh&#039;s Thoughts on SQL Server, Professional Development and Life</description>
	<lastBuildDate>Fri, 30 Jul 2010 18:02:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Mike Walsh</title>
		<link>http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/comment-page-1/#comment-1089</link>
		<dc:creator>Mike Walsh</dc:creator>
		<pubDate>Thu, 29 Jul 2010 19:12:19 +0000</pubDate>
		<guid isPermaLink="false">http://straightpathsql.mikewalshonline.com/?p=16#comment-1089</guid>
		<description>Hi Natasha -

That is some error to make the DB grow to 17GB from 300! :-) This was your .mdf not your .ldf (log file) right?

While it is not good to be in a repeated cycle of shrink-grow-shrink-grow or even do frequent shrink databases on a production system, a one off isn&#039;t bad in a situation like this. What I suggest you do is shrink the database FILE that needs to be shrunk, leave a healthy (up to a few years growth would be ideal, even if a guess) amount of free space in the file and then rebuild your indexes after the fact.</description>
		<content:encoded><![CDATA[<p>Hi Natasha -</p>
<p>That is some error to make the DB grow to 17GB from 300! <img src='http://www.straightpathsql.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  This was your .mdf not your .ldf (log file) right?</p>
<p>While it is not good to be in a repeated cycle of shrink-grow-shrink-grow or even do frequent shrink databases on a production system, a one off isn&#8217;t bad in a situation like this. What I suggest you do is shrink the database FILE that needs to be shrunk, leave a healthy (up to a few years growth would be ideal, even if a guess) amount of free space in the file and then rebuild your indexes after the fact.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Natasha</title>
		<link>http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/comment-page-1/#comment-1088</link>
		<dc:creator>Natasha</dc:creator>
		<pubDate>Thu, 29 Jul 2010 17:02:38 +0000</pubDate>
		<guid isPermaLink="false">http://straightpathsql.mikewalshonline.com/?p=16#comment-1088</guid>
		<description>I would like your opinion please.

My database was about 300 MB a few days back. Due to an error it grew to 17GB overnight. I have fixed the problem to an extent by deleting the swollen records and database backups are in the region of 300MB again. However the mdf file still remains 17GB. Is it a good idea to shrink the database?

My concern is that this database is very small and so is the server where it stands; in relative terms 17GB (x2, production and test) is a lot of space to block and could be used more effectively otherwise.

Thanks in advance
Natasha</description>
		<content:encoded><![CDATA[<p>I would like your opinion please.</p>
<p>My database was about 300 MB a few days back. Due to an error it grew to 17GB overnight. I have fixed the problem to an extent by deleting the swollen records and database backups are in the region of 300MB again. However the mdf file still remains 17GB. Is it a good idea to shrink the database?</p>
<p>My concern is that this database is very small and so is the server where it stands; in relative terms 17GB (x2, production and test) is a lot of space to block and could be used more effectively otherwise.</p>
<p>Thanks in advance<br />
Natasha</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hey Software Vendors! Get a Clue about SQL Server &#124; SQL Server Blog - StraightPath Solutions</title>
		<link>http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/comment-page-1/#comment-818</link>
		<dc:creator>Hey Software Vendors! Get a Clue about SQL Server &#124; SQL Server Blog - StraightPath Solutions</dc:creator>
		<pubDate>Fri, 02 Jul 2010 15:15:09 +0000</pubDate>
		<guid isPermaLink="false">http://straightpathsql.mikewalshonline.com/?p=16#comment-818</guid>
		<description>[...] documentation. Talk about recovery models so you don&#8217;t end up with huge transaction logs and bad advice being given to your customer&#8217;s IT support team from Google and [...]</description>
		<content:encoded><![CDATA[<p>[...] documentation. Talk about recovery models so you don&#8217;t end up with huge transaction logs and bad advice being given to your customer&#8217;s IT support team from Google and [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 5 Things SQL Server Should DROP &#124; SQL Server Blog - StraightPath Solutions</title>
		<link>http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/comment-page-1/#comment-613</link>
		<dc:creator>5 Things SQL Server Should DROP &#124; SQL Server Blog - StraightPath Solutions</dc:creator>
		<pubDate>Tue, 11 May 2010 16:12:41 +0000</pubDate>
		<guid isPermaLink="false">http://straightpathsql.mikewalshonline.com/?p=16#comment-613</guid>
		<description>[...] SQL Blogging with a series of rants about shrinking databases. I still get hits to articles like “Don’t Touch That Shrink Button!” from web searches or forums. The simple fact of the matter is.. Well to put it simply, “raise [...]</description>
		<content:encoded><![CDATA[<p>[...] SQL Blogging with a series of rants about shrinking databases. I still get hits to articles like “Don’t Touch That Shrink Button!” from web searches or forums. The simple fact of the matter is.. Well to put it simply, “raise [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Walsh</title>
		<link>http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/comment-page-1/#comment-371</link>
		<dc:creator>Mike Walsh</dc:creator>
		<pubDate>Tue, 30 Mar 2010 02:27:34 +0000</pubDate>
		<guid isPermaLink="false">http://straightpathsql.mikewalshonline.com/?p=16#comment-371</guid>
		<description>Hey Chris -

Thanks for the comment. I&#039;ll give a quick response now before hitting bed. Feel free to shoot me an e-mail mike at the domain of this blog works, your e-mail address looks like a fake one to prevent spam.

I would say in this case a shrink sounds like an alright idea. I would say set the final size to the size you expect the file to be in a couple/few years if possible. This will prevent the file from having to autogrow in small chunks. While at it, I would also suggest to change the auto growth from the default 1MB, something more in line with the size of the DB. Paul and Kimberly blog about this over at their site and that link from Paul at the end of the above article is a good place to go look for more.



The goal is to avoid physical file fragmentation from lots of growths. Growths were more expensive before Instant File Initialization  starting in 2005 but the effect on physical files (not index fragmentation but on disk file fragmentation) still exists. 

So I would say a shrink of the file to an appropriate size is not a horrible solution. I would caution you to not shrink the database but just the data files and consider the impact of VLF fragmentation</description>
		<content:encoded><![CDATA[<p>Hey Chris -</p>
<p>Thanks for the comment. I&#8217;ll give a quick response now before hitting bed. Feel free to shoot me an e-mail mike at the domain of this blog works, your e-mail address looks like a fake one to prevent spam.</p>
<p>I would say in this case a shrink sounds like an alright idea. I would say set the final size to the size you expect the file to be in a couple/few years if possible. This will prevent the file from having to autogrow in small chunks. While at it, I would also suggest to change the auto growth from the default 1MB, something more in line with the size of the DB. Paul and Kimberly blog about this over at their site and that link from Paul at the end of the above article is a good place to go look for more.</p>
<p>The goal is to avoid physical file fragmentation from lots of growths. Growths were more expensive before Instant File Initialization  starting in 2005 but the effect on physical files (not index fragmentation but on disk file fragmentation) still exists. </p>
<p>So I would say a shrink of the file to an appropriate size is not a horrible solution. I would caution you to not shrink the database but just the data files and consider the impact of VLF fragmentation</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/comment-page-1/#comment-370</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Tue, 30 Mar 2010 02:17:54 +0000</pubDate>
		<guid isPermaLink="false">http://straightpathsql.mikewalshonline.com/?p=16#comment-370</guid>
		<description>Thanks for the article Mike.

I have a client who&#039;s asked a question about shrinking a database. I&#039;d be interested to get yours Mike or other people&#039;s thoughts. Here&#039;s the background;

The client has moved a large table to a new database and the result is that the original database file is now 75% free space (presumably they were intending to free the space up and possibly going for performance perks).

They asked my opinion of shrinking. I started writing basically that while auto or scheduled-manual shrinking is typically a bad idea, a one off will be ok, but before sending it Googled &quot;don&#039;t shrink sql server database&quot; to find arguments against doing it - I came across this article.

Lets assume the growth is predictable and auto-growth settings are sensible. Do you think there would be any problem with performing a one-off shrink in this case? How about a shrink, manually setting the shrunk file size to be a little greater than 1 auto-growth unit so that an auto-grow will not immediately occur?

Index defrag is regularly performed and I&#039;m also recommending performing a full backup first and doing this in a change window in case a restore is required.

Chris
DBA
Perth, Australia</description>
		<content:encoded><![CDATA[<p>Thanks for the article Mike.</p>
<p>I have a client who&#8217;s asked a question about shrinking a database. I&#8217;d be interested to get yours Mike or other people&#8217;s thoughts. Here&#8217;s the background;</p>
<p>The client has moved a large table to a new database and the result is that the original database file is now 75% free space (presumably they were intending to free the space up and possibly going for performance perks).</p>
<p>They asked my opinion of shrinking. I started writing basically that while auto or scheduled-manual shrinking is typically a bad idea, a one off will be ok, but before sending it Googled &#8220;don&#8217;t shrink sql server database&#8221; to find arguments against doing it &#8211; I came across this article.</p>
<p>Lets assume the growth is predictable and auto-growth settings are sensible. Do you think there would be any problem with performing a one-off shrink in this case? How about a shrink, manually setting the shrunk file size to be a little greater than 1 auto-growth unit so that an auto-grow will not immediately occur?</p>
<p>Index defrag is regularly performed and I&#8217;m also recommending performing a full backup first and doing this in a change window in case a restore is required.</p>
<p>Chris<br />
DBA<br />
Perth, Australia</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How to REALLY Compress Your SQL Server Backups &#124; Brent Ozar - Too Much Information</title>
		<link>http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/comment-page-1/#comment-194</link>
		<dc:creator>How to REALLY Compress Your SQL Server Backups &#124; Brent Ozar - Too Much Information</dc:creator>
		<pubDate>Mon, 15 Feb 2010 14:01:16 +0000</pubDate>
		<guid isPermaLink="false">http://straightpathsql.mikewalshonline.com/?p=16#comment-194</guid>
		<description>[...] &#8211; nowhere in today&#8217;s discussion am I going to shrink the databases. Shrinking databases is evil. Instead, we&#8217;re going to do some things to lose the fat and keep the [...]</description>
		<content:encoded><![CDATA[<p>[...] &#8211; nowhere in today&#8217;s discussion am I going to shrink the databases. Shrinking databases is evil. Instead, we&#8217;re going to do some things to lose the fat and keep the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Walsh</title>
		<link>http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/comment-page-1/#comment-6</link>
		<dc:creator>Mike Walsh</dc:creator>
		<pubDate>Tue, 29 Sep 2009 20:35:54 +0000</pubDate>
		<guid isPermaLink="false">http://straightpathsql.mikewalshonline.com/?p=16#comment-6</guid>
		<description>&lt;p&gt;I think Brent&#039;s answer on his blog for this same question is the right one: Properly size your database in the first place with the amount you need, room for growth and monitor it closely over time. Shouldn&#039;t have a lot of growth and shrink if you set it up right from the start.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I think Brent&#8217;s answer on his blog for this same question is the right one: Properly size your database in the first place with the amount you need, room for growth and monitor it closely over time. Shouldn&#8217;t have a lot of growth and shrink if you set it up right from the start.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ASP.NET programmer</title>
		<link>http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/comment-page-1/#comment-5</link>
		<dc:creator>ASP.NET programmer</dc:creator>
		<pubDate>Tue, 29 Sep 2009 11:54:18 +0000</pubDate>
		<guid isPermaLink="false">http://straightpathsql.mikewalshonline.com/?p=16#comment-5</guid>
		<description>&lt;p&gt;What would webmasters do if database size is limited in hosting services? For example: 120MB before shrinking and 18MB after.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>What would webmasters do if database size is limited in hosting services? For example: 120MB before shrinking and 18MB after.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Walsh</title>
		<link>http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/comment-page-1/#comment-4</link>
		<dc:creator>Mike Walsh</dc:creator>
		<pubDate>Wed, 22 Jul 2009 06:24:41 +0000</pubDate>
		<guid isPermaLink="false">http://straightpathsql.mikewalshonline.com/?p=16#comment-4</guid>
		<description>&lt;p&gt;Hey Barry&lt;/p&gt;&lt;p&gt;I apologize for any confusion I may have caused with my stream of thought style and wording. I can&#039;t speak towards Oracle as I am not as familiar with the physical file organization or the indexing structures in Oracle databases.&lt;/p&gt;&lt;p&gt;For SQL Server the major point I was trying to make, however, was that physical file fragmentation is bad. The Best case is that this fragmentation is handled somewhat alright by the O/S and its defragmentation processes and doesn&#039;t end up a big deal. That was slightly tongue-in-cheek. The more likely case is closer to the worst case: the physical fragmentation will cause pain, the cost of the growths will cause pain and it is sort of all for not when you could have right sized the database from the beginning for a value that you can grow into over time.&lt;/p&gt;&lt;p&gt;Your first thought about reorganizing the database may be induced by some of the wording in SQL Server 2000 maintenance plans which sort of lump an index reorganization and shrink into what seemed like one operation (IIRC). &lt;/p&gt;&lt;p&gt;There are really two main kinds of fragmentation to think about here: Physical File Fragmentation (you want to prevent this by trying to minimize growths and don&#039;t shrink your production database) and index fragmentation (which comes in two forms.. One form being your index pages no longer physically in the logical order of the doubly linked list and the other form being 8KB data pages, due to page splits from inserts/updates and due to delete activities, no longer being as full as they should be). The best way to handle this type of fragmentation is through rebuilding or reorganizing indexes, not shrinking a database.&lt;/p&gt;&lt;p&gt;To be honest, I can&#039;t find any positive benefit from shrinking a production database. All that is designed to do is reduce the free space within your database files. Yes there is an option during a shrink that can reorganize data as best as possible to determine where that free space comes from but this doesn&#039;t mean deal with index fragmentation.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hey Barry</p>
<p>I apologize for any confusion I may have caused with my stream of thought style and wording. I can&#8217;t speak towards Oracle as I am not as familiar with the physical file organization or the indexing structures in Oracle databases.</p>
<p>For SQL Server the major point I was trying to make, however, was that physical file fragmentation is bad. The Best case is that this fragmentation is handled somewhat alright by the O/S and its defragmentation processes and doesn&#8217;t end up a big deal. That was slightly tongue-in-cheek. The more likely case is closer to the worst case: the physical fragmentation will cause pain, the cost of the growths will cause pain and it is sort of all for not when you could have right sized the database from the beginning for a value that you can grow into over time.</p>
<p>Your first thought about reorganizing the database may be induced by some of the wording in SQL Server 2000 maintenance plans which sort of lump an index reorganization and shrink into what seemed like one operation (IIRC). </p>
<p>There are really two main kinds of fragmentation to think about here: Physical File Fragmentation (you want to prevent this by trying to minimize growths and don&#8217;t shrink your production database) and index fragmentation (which comes in two forms.. One form being your index pages no longer physically in the logical order of the doubly linked list and the other form being 8KB data pages, due to page splits from inserts/updates and due to delete activities, no longer being as full as they should be). The best way to handle this type of fragmentation is through rebuilding or reorganizing indexes, not shrinking a database.</p>
<p>To be honest, I can&#8217;t find any positive benefit from shrinking a production database. All that is designed to do is reduce the free space within your database files. Yes there is an option during a shrink that can reorganize data as best as possible to determine where that free space comes from but this doesn&#8217;t mean deal with index fragmentation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry Cohen</title>
		<link>http://www.straightpathsql.com/archives/2009/01/dont-touch-that-shrink-button/comment-page-1/#comment-3</link>
		<dc:creator>Barry Cohen</dc:creator>
		<pubDate>Mon, 20 Jul 2009 16:35:20 +0000</pubDate>
		<guid isPermaLink="false">http://straightpathsql.mikewalshonline.com/?p=16#comment-3</guid>
		<description>&lt;p&gt;I know this comment comes late in the game, but I have a question that you may be able to answer:&lt;/p&gt;&lt;p&gt;I was under the impression that one of the reasons to shrink  a database was to defragment the database files, something that can have a positive effect on transaction heavy databases (or so Oracle would like me to believe).You seem to be saying this is true:&lt;br/&gt; &lt;blockquote&gt;Deallocate that space and let the O/S do what it needs with it. If you have a growing database (as the majority of non-static databases tend to be), this means that that database will grow again. Depending on your autogrowth settings (another pet peeve for another post) this growth will probably be more than necessary and you will end up shrinking again... At best this is just extra work (shrink grow/shrink grow) and the resulting file fragmentation is handled alright by your I/O subsystem. At worse this is causing file fragmentation, interrupting what would have otherwise been contigous files and potentially causing I/O related performacne problems.&quot;&lt;/blockquote&gt;&lt;/p&gt;&lt;p&gt;I&#039;m not clear what the difference is. Do you mean that the OS (or a commercial disk defragger for that matter) will handle defragmentation adequately without worrying about the internal shrink function? Another way of saying this: If file level fragmentation is an issue for an organization, simply running Windows deframentation tools will address this issue regardless of what&#039;s done in SQL Server and you don&#039;t need to run a separate routine for this purpose, unlike, say Oracle database?&lt;/p&gt;&lt;p&gt;Thanks&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I know this comment comes late in the game, but I have a question that you may be able to answer:</p>
<p>I was under the impression that one of the reasons to shrink  a database was to defragment the database files, something that can have a positive effect on transaction heavy databases (or so Oracle would like me to believe).You seem to be saying this is true:<br /> <br />
<blockquote>Deallocate that space and let the O/S do what it needs with it. If you have a growing database (as the majority of non-static databases tend to be), this means that that database will grow again. Depending on your autogrowth settings (another pet peeve for another post) this growth will probably be more than necessary and you will end up shrinking again&#8230; At best this is just extra work (shrink grow/shrink grow) and the resulting file fragmentation is handled alright by your I/O subsystem. At worse this is causing file fragmentation, interrupting what would have otherwise been contigous files and potentially causing I/O related performacne problems.&quot;</p></blockquote>
<p>I&#8217;m not clear what the difference is. Do you mean that the OS (or a commercial disk defragger for that matter) will handle defragmentation adequately without worrying about the internal shrink function? Another way of saying this: If file level fragmentation is an issue for an organization, simply running Windows deframentation tools will address this issue regardless of what&#8217;s done in SQL Server and you don&#8217;t need to run a separate routine for this purpose, unlike, say Oracle database?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>
