Truncating log file vs Checkpoint

  • Hi,

    As per my knowledge when checkpoint occurs it marks VLFs from active to inactive and it also flush dirty pages to datafile. And at the time of truncating log file it marks those inactive VLFs to be reused, so those VLFs can be reused further. Please correct me if I am wrong.

    Thanks in advance.

  • This article should help you understand it.

    http://www.sqlservercentral.com/articles/Transaction+Log/72488/

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Truncating the log is the process of marking 0 or more VLFs as inactive. The log is truncated by a checkpoint in simple recovery and a log backup in full recovery.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • And Checkpoint flush dirty buffer to disk and mark VLFs to reusable for further use. Please correct me if I am wrong.

    Thanks in advance.

  • In simple recovery a checkpoint writes all dirty pages to disk and truncates the log. In full and bulk-recovery it just writes dirty pages to disk.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Ok, then how log file gets truncated in Bulk and Full recovery mode ? After every log backup or any other situation when truncate occurs.

    Thanks in advance.

  • Yes and yes. There are certain commands that will truncate the log without backing it up. I suggest you go to the link that Jason posted - I'd be surprised if it doesn't answer all that and more.

    John

  • GilaMonster (8/24/2011)


    The log is truncated by a checkpoint in simple recovery and a log backup in full recovery.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks all for answering my queries.

  • you're welcome

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 10 posts - 1 through 9 (of 9 total)

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