Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 shrink

Author  Topic 

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-09-24 : 02:49:30
shrink is risk to the data?

do i need shrink every day?

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2009-09-24 : 04:44:39
It's no risk to the data, but you shouldn't be shrinking on a regular basis at all.

Why do you want to shrink anyway? Databases tend to grow as more data gets put in them. It's in their nature.

Shrinking causes massive fragmentation and will just result in the data file growing again next time data gets added. When that happens, the entire system will slow down as the file is expanded. Also repeated shrinks and grows will cause fragmentation at the file-system level, which is hard to fix.

See - [url]http://sqlinthewild.co.za/index.php/2007/09/08/shrinking-databases/[/url]

--
Gail Shaw
SQL Server MVP
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-09-24 : 05:21:43
thanks, i think like you.

i dont see somethink like that in the article except about index.

where can i find article from MSDN
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2009-09-24 : 08:26:06
Article on MSDN about what?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-09-24 : 08:32:47
about what you said. "Shrinking causes massive fragmentation"
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2009-09-24 : 10:53:59
Did you read my blog post? I admit it's not on MSDN, but the post was all about the fragmentation that shrinking causes and showed fragmentation of an index before and after shrinking the DB.

If you want more, try this one and all the posts it links to.
http://www.brentozar.com/archive/2009/08/stop-shrinking-your-database-files-seriously-now/

--
Gail Shaw
SQL Server MVP
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-09-25 : 10:15:20
GilaMonster ,in your post you write :
There are cases where shrinking data files does make sense. When a process created lots of tables for processing then dropped them again, after a massive archiving job, after changing data types in a table to release a large amount of wasted space (more on that another time). Just be aware of the effect of a shrink on the fragmentation of indexes.

if we delete and insert increment (around 50K rows) every day
so we need to shrink every day?
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2009-09-25 : 10:19:43
No, absolutely not.
The case for shrink is when you've done a massive archiving job and do not expect the free space to be reused in a few months. Shrinking every day is an incredibly bad idea. Besides, 50k rows is a very small number. I was talking about archiving several million, resulting in many GB of free space. Not a few MB.

Please read the post of Brent's that I linked to and all the posts that references.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -