Common misconceptions about SQL Server checkpoint

Source: Internet
Author: User
Tags log

The concept of checkpoint is not unfamiliar to most SQL Server development or DBA personnel. However, including myself, we all have more or less some misunderstandings about checkpoint, recently and Gao Wenjia classmate (thanks to the discussion of high school students) about the department conducted some discussion, sorted out a few misunderstandings.

1.CheckPoint instance level, not database level

Although the checkpoint time can be set at the instance level, the checkpoint process is based on the database granularity. From the role of checkpoint in redo and undo, checkpoint is designed to optimize IO and reduce recovery time, while recovery requires log support, so the log is a database-level concept, It is therefore possible to know that the checkpoint is in the database unit.

Let's do a simple experiment, set up two connections A and b,a and B to use different databases and modify data to produce dirty data, after a checkpoint, a connected database dirty pages are all written to disk, and B connection generated dirty pages still reside in buffer, Therefore, you can determine that checkpoint is a database level, not a server level.

Figure 1. Checkpoint is database level

2. Automatic checkpoint caused by log growth writes dirty pages of all databases to disk

As it turns out, this is also a mistake, and automatic checkpoint will simply write some dirty pages or log too many database dirty pages to disk. You can also do this by using the example in Figure 1.

3.CheckPoint writes only dirty data that has been submitted to disk

This is also wrong, regardless of whether the transaction is committed, the resulting dirty data will be written to disk by checkpoint. Examples can be shown in my blog post: Talk about checkpoint in the role of log in SQL Server.

4. If there is more than one database on an instance, the checkpoint is parallel

Error, through the 3502 tracking tag, checkpoint is serial, that is, a database checkpoint will continue to the next. As shown in Figure 2.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/SQLServer/

Figure 2. Serial Checkpoint

We can note that checkpoint is using the same SPID.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.