DIRTY_PAGE_POLL Wait Type In SQL Server

The DIRTY_PAGE_POLL is a wait type that behaves like CHECKPOINT_QUEUE. This wait type was introduced in SQL Server 2012 with an indirect checkpoint feature. In most cases, the DIRTY_PAGE_POLL wait type can be ignored, it becomes important for all DBAs to have a basic idea of this wait type when it gets generated.

What is the DIRTY_PAGE_POLL Wait Type?

The DIRTY_PAGE_POLL wait type is a background wait that is related to the recovery writer process that is used by the indirect checkpoint feature. The wait type runs continuously in the background of your SQL Server instance. 

The checkpoint process inside the SQL Server is accountable for writing modified data pages from the buffer cache to the database data files on disk. The automatic checkpoint process runs regularly at a set interval of 1 minute. However, the indirect checkpoint feature will allow you to configure a specific checkpoint interval at the database level.

The checkpoint process is very important in the recovery of a SQL Server database when any crash happens.

Case Scenario:

Suppose you were working on a SQL Server instance and suddenly your server crashed. Fortunately, with a simple restart of SQL Server service, all gets back to normal. The first thing the SQL Server does is to start a recovery process. The recovery process checks for the transaction log for uncommitted transactions when the crash occurred and performs a rollback of the transaction.

The recovery process checks whether any data pages that were modified but only at the buffer cache level. If there were any transactions in the buffer cache, then such transactions will be redone by the SQL Server from the transaction log. A busy server will have such transactions where a lot of them were trapped in the buffer cache level. In such cases, the recovery time will be more than normal.

Because of the same, from SQL Server 2012 a new feature was introduced "Target Recovery Time" which you can see in the database properties. By configuring this feature, we can tell SQL Server to write the modified data pages to disc faster.

An example of the database properties with the "Target Recovery Time" is shown below.

Feature at the database level:

A sample example of the database properties with the "Target Recovery Time" is shown below.

DIRTY PAGE POLL Wait Type

In the image, the Target Recovery Time option is configured to 0 by default. If the value is 0, then the indirect checkpoint is not being used. If the value is anything greater than 0, an indirect checkpoint will start to happen as per the specification.

The wait type can be queried from sys.dm_os_wait_stats wait type.

DIRTY PAGE POLL Wait Type

Note: Starting from SQL Server 2016, the Target Recovery Time value is set to 60 seconds by default when you create a new database inside the SQL Server instance. In case you are manually changing to a new value of its own, then do not set the option to a low value. A value of less than 60 seconds can impose an extra load on the storage subsystem. This is because the SQL Server will start writing dirty pages continuously to disk. Be very wise while setting the value in the production environment.  

Bottomline:

The DIRTY_PAGE_POLL wait type was introduced in SQL Server 2012. It was an introduction to the indirect checkpoint feature. Starting from SQL Server 2016, the default value was set to 60 for new database creation. The wait type will still get generated in case you are using the feature. The whole point is that the wait type values are for information only and do not impose any performance overhead.

CHECKPOINT_QUEUE Wait Type In SQL Server

CHECKPOINT_QUEUE wait type is a background wait type related to the checkpoint process in SQL Server that is responsible for writing modified (dirty) data pages from the buffer cache to the data file on disk. In most cases, this wait type can be ignored and this is something that most DBAs should be aware of. The CHECKPOINT_QUEUE indicates that the checkpoint process is waiting for work. If you notice this wait type, there shouldn’t be any potential performance issues in most cases. Additionally, it specifies the checkpoint processes spent waiting on work.

If you notice high values of CHECKPOINT_QUEUE wait type, then probably your SQL Server instance is not busy. It means that the SQL Server is expecting some work to come in.

The CHECKPOINT_QUEUE wait type gets recorded in the sys.dm_os_wait_stats and sys.dm_os_waiting_tasks DMVs.

Here is a sample recording of values in both DMVs. 

sys.dm_os_wait_stats:

checkpoint queue wait type

sys.dm_os_waiting_tasks:

Checkpoint Queue Wait Type






Something interesting to note is that both the DMVs are interlinked. Firstly, the value gets records in sys.dm_os_waiting_tasks once the automatic checkpoint occurs. Secondly, the SQL Server internally executes to move the record from sys.dm_os_waiting_tasks to sys.dm_os_wait_stats and reset the value in sys.dm_os_waiting_tasks to 0. 

If you ever experience a high value of CHECKPOINT_QUEUE in sys.dm_os_waiting_tasks then the automatic checkpoint happened sometime back in your SQL Server instance.

Bottomline

The CHECKPOINT_QUEUE wait type is related to checkpoint operations inside SQL Server. They are not any indications of performance issues. The wait type is normal for SQL Server instances and can be safely ignored. The wait type value will be high because the SQL Server instance is waiting for more work to come in. The value gets recorded in the sys.dm_os_wait_stats and sys.dm_os_waiting_tasks.