Checkpoint Duration

  • Is there any way to know, what is the duration set for Checkpoint.

    I know we can set\customize it, but i want to know the current duration, if someone has changed it.

    Also i want to know if there is any default duration for checkpoint.

    As per my understanding SQL Server manage this automatically.

    Is it related to REcovery Interval Setting?

    Regards,
    Sarabpreet Singh 😎
    Sarabpreet.com
    SQLChamp.com
    Twitter: @Sarab_SQLGeek

  • As per my knowledge, there is no default duration for checkpoint to happen. It happens based on certain events.

    here are some excerpts from BOL.

    Events That Cause Checkpoints

    Before a database backup, the Database Engine automatically performs a checkpoint so that all changes to the database pages are contained in the backup. In addition, checkpoints occur automatically when either of the following conditions occur:

    The active portion of the log exceeds the size that the server could recover in the amount of time specified in the recovery interval server configuration option.

    The log becomes 70 percent full, and the database is in log-truncate mode.

    A database is in log truncate mode when both these conditions are TRUE: the database is using the Simple recovery model, and, after execution of the last BACKUP DATABASE statement that referenced the database, one of the following events occurs:

    A minimally logged operation is performed in the database, such as a minimally logged bulk copy operation or a minimally logged WRITETEXT statement is executed.

    An ALTER DATABASE statement is executed that adds or deletes a file in the database.

    Also, stopping a server issues a checkpoint in each database on the server. The following methods of stopping SQL Server perform checkpoints for each database:

    Using SQL Server Configuration Manager.

    Using SQL Server Management Studio.

    Using the SHUTDOWN statement.

    Refer HERE

    The page also explains the factors affecting the duration of checkpoint operations.



    Pradeep Singh

  • :unsure: but i want to know the current duration

    Regards,
    Sarabpreet Singh 😎
    Sarabpreet.com
    SQLChamp.com
    Twitter: @Sarab_SQLGeek

  • you can query fn_dblog undocumented command to browse through the transaction log to find out when it was last run. I'm unaware about the exact search string for checkpoint but perhaps u'll need to place the condition on the context or operation column. just query this command to look out for exact detail u need.

    see if this helps.



    Pradeep Singh

  • There's no default duration or setting that affects a checkpoint's duration. You can change the recovery interval, which affects how often the checkpoint runs, nothing else.

    How long a checkpoint takes depends totally on how many changes have occurred in the database since the previous checkpoint ran.

    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, so if i want to commit all the changes at a rapid speed i can request a checkpoint with a small duration & SQL will put all the required resources to complete checkpoint within the requested time.

    Got It.

    But lets say i am changing the Recovery Interval(I know its not the best practice, i am just taking an example) to a duration of 90Secs then whether this setting will be applied for the checkpoint (which SQL runs at the time of startup) or the setting will be applied for each and every Checkpoint which happens at some specific intervals?

    Thanks

    Regards,
    Sarabpreet Singh 😎
    Sarabpreet.com
    SQLChamp.com
    Twitter: @Sarab_SQLGeek

  • Sarab (8/16/2009)


    Ok, so if i want to commit all the changes at a rapid speed i can request a checkpoint with a small duration & SQL will put all the required resources to complete checkpoint within the requested time.

    No, not at all.

    You cannot control the duration of checkpoint. It runs for as long as it takes to write all dirty data pages to disk. SQL will write those pages as fast as it can, depending on the throughput of the IO subsystem.

    But lets say i am changing the Recovery Interval(I know its not the best practice, i am just taking an example) to a duration of 90Secs then whether this setting will be applied for the checkpoint (which SQL runs at the time of startup) or the setting will be applied for each and every Checkpoint which happens at some specific intervals?

    Recovery interval indirectly controls how often checkpoint runs.

    By setting the recovery interval to 90 sec, you're saying to SQL run the checkpoint process often enough that should the SQL service restart unexpectedly, the duration of the restart recovery will not exceed 90 seconds.

    The higher the restart interval is set, in general, the less often checkpoint will run and the longer it'll take each time. But you cannot directly control checkpoint interval or duration.

    This blog post may help a bit - http://sqlinthewild.co.za/index.php/2009/06/26/the-lazy-writer-and-the-checkpoint/

    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.

    now its Clear to me.

    Regards,
    Sarabpreet Singh 😎
    Sarabpreet.com
    SQLChamp.com
    Twitter: @Sarab_SQLGeek

  • HiGail,

    Can you please explain "By setting the recovery interval to 90 sec, you're saying to SQL run the checkpoint process often enough that should the SQL service restart unexpectedly, the duration of the restart recovery will not exceed 90 seconds."

    Does it mean that SQL Server will automatically apply Checkpoint command to the database after 90 seconds?

    Thanks in advance!!!

  • Well, just to be clear, there's no way to control the duration of an automatic checkpoint.

    For a manual checkpoint, you can specify a target duration. From https://msdn.microsoft.com/en-us/library/ms188748.aspx:

    checkpoint_duration

    Specifies the requested amount of time, in seconds, for the manual checkpoint to complete. When checkpoint_duration is specified, the SQL Server Database Engine attempts to perform the checkpoint within the requested duration. The checkpoint_duration must be an expression of type int and must be greater than zero. When this parameter is omitted, the Database Engine adjusts the checkpoint duration to minimize the performance impact on database applications. checkpoint_duration is an advanced option.

    I've never really found a good use case for it (I suppose IF you had to run manual checkpoints and IF you wanted the writes to be distributed over either a shorter or longer time period than SQL Server was choosing, that would be the use, but those are some really big ifs), but it technically does exist 🙂

    Cheers!

    EDIT: Just noticed how old this thread is...that's what I get for responding before a cup of coffee 🙂

  • Thank you Jacob for your reply. 🙂

  • Thank you Jacob for the response 🙂

Viewing 12 posts - 1 through 11 (of 11 total)

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