KB4163087 - FIX: Performance is slow for an Always On AG when you process a read query in SQL Server

Applies to: SQL Server 2016 DeveloperSQL Server 2016 EnterpriseSQL Server 2016 Enterprise Core


Assume that you have an Always On Availability Group (AG) in SQL Server 2016 and 2017. When you process a read query on a secondary replica, the performance might be much slower than the primary replica due to frequent DIRTY_PAGE_TABLE_LOCK waits.


This issue occurs because of contention between the read query and the redo thread, and because the table is locked.


This fix is included in the following updates for SQL Server:

Cumulative Update 8 for SQL Server 2017 

Cumulative Update 1 for SQL Server 2016 Service Pack 2

Cumulative Update 9 for SQL Server 2016 Service Pack 1


To work around this issue you can use a single redo thread instead of a parallel redo thread by enabling Trace Flag 3459.

More Information

When read-only queries are running on a readable secondary replica, query threads attempt to apply pending log redo operations and need to collaborate with redo worker threads with DIRTY_PAGE_TABLE_LOCK waits, which can be frequently generated and slow down both redo and query performance if there are concurrent redo workloads. The performance issue associated with DIRTY_PAGE_TABLE_LOCK wait is addressed in the cumulative update release for SQL Server 2016 SP and SQL Server 2017 mentioned in this article.

For more information, you can see the following blog on Availability group secondary replica redo model and performance.


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.


Learn about the terminology Microsoft uses to describe software updates.