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)
 Best Practice - AutoShrink

Author  Topic 

nhess80
Yak Posting Veteran

83 Posts

Posted - 2009-02-16 : 14:57:44
I know that auto shrink has been covered in this forum and it is said not to use it but I need your opinions on how I should handle what I am doing. It seems that shrinking the db would be good in my situation and if it is not I was hoping to get some guidance on how I should handle this.

I deal with large amount of data and the files that hold the data that I do a bulk insert into my database are usually around 100mb and about 500,000 rows. These files are created daily and inserted weekly. So on Mondays I am inserting around 3.5 million rows. Now not all of this data is kept. The data is first inserted into a holding table and after that is done a query is run to grab the data that is needed and move that to another table. After that is done the holding table is truncated. This is done every week. My question is, is this something that I should use auto shrink or should I still not use this? I was trying to figure out a way to just shrink the holding table because I don’t want to fragment other tables in the DB. Any help would be great.

Thanks,

Nick

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-16 : 15:48:23
You still should not use auto shrink.

Your database is going to need that space every time you run this process, so just let it have the space.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

nhess80
Yak Posting Veteran

83 Posts

Posted - 2009-02-16 : 16:02:26
Ok thank you for the quick response. I was just under the impression that it would keep getting bigger every time I inserted that data.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-16 : 18:42:45
It can reuse the space if you truncated the data.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-02-16 : 20:09:39
You can add a filegroup to your database and add a new data file to it specifically for this holding table. If you can place the file on a disk that is physically separate from the rest of your database it should also improve bulk loading performance. Either way, having a separate file and filegroup for bulk loading will reduce or even prevent other tables from being fragmented.
Go to Top of Page

nhess80
Yak Posting Veteran

83 Posts

Posted - 2009-02-17 : 12:27:06
Do you know of a good place that I can read about adding a filegroup? I have never done anything like that before

quote:
Originally posted by robvolk

You can add a filegroup to your database and add a new data file to it specifically for this holding table. If you can place the file on a disk that is physically separate from the rest of your database it should also improve bulk loading performance. Either way, having a separate file and filegroup for bulk loading will reduce or even prevent other tables from being fragmented.

Go to Top of Page

mfemenel
Professor Frink

1421 Posts

Posted - 2009-02-17 : 12:55:04
Books on line covers this pretty thoroughly. You can also right click the database, choose Properties and you'll have a filegroup section where you can add it.

Mike
"oh, that monkey is going to pay"
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-17 : 14:09:38
Also moving clustered index to other filegroup will move table as well but not with non-clustered index.
Go to Top of Page
   

- Advertisement -