when to truncate and when to shrink the database

  • Hi all ,

    SQL server 2005[Standard]

    when to Truncate and when to Shrink database

    Thanks

    Naga.RohitKumar

    Thanks
    Naga.Rohitkumar

  • those are two different things:

    TRUNCATE => delete all rows from a specified table

    SHRINK => release unused diskspace within the database file to the OS

    Shrinking is not recommended, you can find many posts about the (bad) implications of shrinking on this forum.

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • HanShi (9/19/2014)


    those are two different things:

    TRUNCATE => delete all rows from a specified table

    SHRINK => release unused diskspace within the database file to the OS

    Shrinking is not recommended, you can find many posts about the (bad) implications of shrinking on this forum.

    The OP might mean "truncating the log".

    Which happens after you take a transaction log back-up.

    With truncating, old transactions are removed from the transaction log (and put in the back-up). The size of the transaction log stays the same.

    With shrinking, you reduce the actual file size of the log. However, usually the transaction log was that big for a reason, so it will probably grow again.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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