Several misunderstandings about SQLServerCheckPoint

Source: Internet
Author: User
The concept of CheckPoint is no stranger to most SQLServer developers or DBAs. However, including myself, there are more or less misunderstandings about checkpoints. Recently, Gao wenjia (thanks to Gao for his discussion) has discussed this area and sorted out several misunderstandings. 1. CheckPoint instance level, not database level

The concept of CheckPoint is no stranger to most SQL Server developers or DBAs. However, including myself, there are more or less misunderstandings about checkpoints. Recently, Gao wenjia (thanks to Gao for his discussion) has discussed this area and sorted out several misunderstandings. 1. CheckPoint instance level, not database level

The concept of CheckPoint is no stranger to most SQL Server developers or DBAs. However, including myself, there are more or less misunderstandings about checkpoints. Recently, Gao wenjia (thanks to Gao for his discussion) has discussed this area and sorted out several misunderstandings.

 

1. CheckPoint instance level, not database level

Although the CheckPoint time can be set at the instance level, the CheckPoint process takes the database as the granularity. From the perspective of the role of CheckPoint in Redo and Undo, CheckPoint is designed to optimize IO and reduce the rediscovery time, while rediscovery requires log support. Therefore, logs are database-level concepts, therefore, we can know that the CheckPoint is performed in database units.

Let's do A simple experiment. We set two connections A and B respectively. A and B use different databases and modify the data to generate dirty data. After A CheckPoint is performed on, the dirty pages of the database connected to A are all written to the disk, while the dirty pages generated by connection B still reside in the Buffer. Therefore, we can determine that the CheckPoint is at the database level rather than the server level.

Because SQL Server needs to ensure that all data is written to the disk at this time to ensure Database Consistency. If there are no active transactions, this close method is called Clean ShutDown, which means that the data itself is consistent, therefore, MDF can be attached even if no logs exist.

 

7. CheckPoint is a time point (Added by Gao)

Error: this is the idea of playing a game archive. It is a certain time point, from where to save the progress, from where to get the progress. In SQL Server, CheckPoint is a complete process. The duration of this process depends on the size of dirty data. For more information, see MSDN:

 

8. The condition for triggering an automatic CheckPoint is the number of dirty pages in the memory (Added by Gao)

Error. The trigger condition of the CheckPoint is the log size generated during the CheckPoint. Therefore, we have seen many dirty pages in the memory, but do not trigger CheckPoint.

 

9. When the pressure on the disk where the data is located is high, use the checkpoint pages/sec counter to observe the dirty pages written to the disk (Added by Gao)

Partially correct. In fact, there are three ways to write dirty pages to a disk. The CheckPoint is only one of them. We also need to consider Lazy writes/sec.

 

10. Dirty pages will never be written to TempDB

Error. TempdB is a special database that can only be restored in simple mode. If you create a large number of dirty pages in TempDB, you will find that no dirty pages are written during Automatic checkpoints, however, when a manual CheckPoint is used, dirty pages are still written to the disk.

 

 

Finally, I would like to thank Gao wenjia for discussing with me.

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.