Need to maintain the databases

  • I have a database in a simple mode as we do not use transaction logs for restore purposes, I ran some queries to delete some data and not nsed tables to free up some space.

    I give you an example, I have a database 70 GB in size, I deleted the data and I still see my database is showing the same size, can I shrink the data files,

    what is the risk please? Can I get the best way to go around to get the space freed up,

    Thanks in Advance,

    Bubby

  • Deleting data will only free up space within the database, not actually deallocate any pages, hence your data files will remain exctly the same size after a delete (your log files may actually grow if you run large delete operations since they too have to be logged). If you are sure you will not need that space again in the foreseeable future, you may shrink the database to free up disk space, but be sure to rebuild indexes afterwards because shrinking tends to mess up the physical order of your data on the disk. Also, don't shrink it just to shrink it. You should only do this if you know you're not going to need that space again for this DB and/or the space is urgently needed for other purposes.

    The main risk is that shrinking databases that only have to grow again shortly afterwards wastes both time and resources and actually harms performance.


    Kind regards,

    Vegard Hagen
    Norwegian DBA, occasional blogger and generally a nice guy who believes the world is big enough for all of us.
    @vegard_hagen on Twitter
    Blog: Vegards corner (No actual SQL stuff here - havent found my niche yet. Maybe some day...)

    It is better to light a candle than to curse the darkness. (Chinese proverb)
  • Thanks a Lot, I will keep this in mind,

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply