Sunday, February 12, 2012

Autoshrink efficiency

Howdy folks!

I've got a database that needs to run 24/7. I'm looking into maintanence options and wanted to run the following by y'all:

Ok, I've read the MSDN "Maintaining databases" article and noticed the following statement about autoshrinking: "This technique uses almost no processor time and memory". I also searched these forums and found that many users say autoshrinking heavily lags down sql transfers. So who's right? And if it does lag transfers, by how much?

Another question I have about autoshrink is fragmentation. It would seem to me that over time solely depending on autoshrink would cripple a server in terms of fragmentation; is this the case?

Also, does autoshrink (or manual shrinking or compacting) update the statistics?

Final question!!! I'm programming in native c++, is there a way for me to run commands such as "DBCC SHRINKDATABASE" in native OLE DB code?

Thanks!

Autoshrink in SQL CE takes place when the last connection to the database is closed, so it has very littel effect on your app.

Autoshrink is not a replacement for CompactDatabase, so you should do that regurarly (every 14 days in ceonnection with sync process, for example)

Statistics: Most likely...yes

the native interface exposes CompactDatabase on an Engine object, see this:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1934047&SiteID=1

|||Thanks for the reply Erik!

One more question...if I insert 1000 rows, delete all but 50, then insert 950 more, will my filesize stay consistant to just inserting 1000 rows?

In other words, are deleted rows replaced when inserting new rows?
|||No, used pages are not reclaimed, that is why there are features like "auto shrink" and CompactDatabase

No comments:

Post a Comment