December 27, 2017 at 6:42 pm
Comments posted to this topic are about the item Shrink all user database files
December 27, 2017 at 7:07 pm
I appreciate you sharing but, be advised, shrinking databases every day is a form of "Death by SQL".
1. It can and usually will cause a type of fragmentation that can absolutely cripple your database for performance. The only way to recover from that is to do the necessary index maintenance and that can cause wanton growth of the MDF file if you use REBUILD or wanton growth of the LDF file if you use REORGANIZE.
2. Except when there has been accidental and incredible growth of either the MDF or LDF files, shrinking the database on a daily basis is totally fruitless unless you find out what is causing the excessive growth. It's a whole lot like washing your clothes and then drying them on a clothesline in the rain with the occasional dog lifting his leg on the basket you also left outside.
3. Shrinking the databases takes valuable time away from more useful and more critical maintenance such as finding stats the need to be updated and then updating them.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 27, 2017 at 7:16 pm
Why would you want to do that? I can see shrinking a database if you have to move it and space is at a premium. But that's hopefully a rare occurrence. One would be much better tracking growth rates and projecting when a server is projected to run out of space at the current growth rate, and then addressing the problem proactively.
December 28, 2017 at 9:34 am
Jeff Moden - Wednesday, December 27, 2017 7:07 PMI appreciate you sharing but, be advised, shrinking databases every day is a form of "Death by SQL".1. It can and usually will cause a type of fragmentation that can absolutely cripple your database for performance. The only way to recover from that is to do the necessary index maintenance and that can cause wanton growth of the MDF file if you use REBUILD or wanton growth of the LDF file if you use REORGANIZE.
2. Except when there has been accidental and incredible growth of either the MDF or LDF files, shrinking the database on a daily basis is totally fruitless unless you find out what is causing the excessive growth. It's a whole lot like washing your clothes and then drying them on a clothesline in the rain with the occasional dog lifting his leg on the basket you also left outside.
3. Shrinking the databases takes valuable time away from more useful and more critical maintenance such as finding stats the need to be updated and then updating them.
+ 10000
...
December 28, 2017 at 11:16 am
Jeff Moden - Wednesday, December 27, 2017 7:07 PMI appreciate you sharing but, be advised, shrinking databases every day is a form of "Death by SQL".1. It can and usually will cause a type of fragmentation that can absolutely cripple your database for performance. The only way to recover from that is to do the necessary index maintenance and that can cause wanton growth of the MDF file if you use REBUILD or wanton growth of the LDF file if you use REORGANIZE.
2. Except when there has been accidental and incredible growth of either the MDF or LDF files, shrinking the database on a daily basis is totally fruitless unless you find out what is causing the excessive growth. It's a whole lot like washing your clothes and then drying them on a clothesline in the rain with the occasional dog lifting his leg on the basket you also left outside.
3. Shrinking the databases takes valuable time away from more useful and more critical maintenance such as finding stats the need to be updated and then updating them.
Agreed 1000%. Except in rare instances, it's not worth the space you get back. When it is worth the space, you give a bunch of it away by doing the rebuilds. I think the wasted space is generally about 120% the size of your biggest table.
January 2, 2018 at 3:34 am
Why do that ??? Buy some HD
January 2, 2018 at 8:49 am
short answer is don't!!
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
January 2, 2018 at 5:23 pm
Jeff's right but don't be discouraged.
January 21, 2018 at 1:02 pm
January 21, 2018 at 2:18 pm
RandomStream - Tuesday, January 2, 2018 5:23 PMJeff's right but don't be discouraged.
If you're talking about not being discouraged from writing articles, I absolutely agree! If contrary opinion were a deterrent, I'd have never made it past my first article. I actually embrace contrary opinion (although I embrace and value contrary proof in the form of code much more) because it normally causes discussions that flush out some really great ideas or confirms that some ideas aren't so great.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply