{"id":49323,"date":"2023-03-28T08:00:00","date_gmt":"2023-03-28T15:00:00","guid":{"rendered":""},"modified":"2024-01-31T13:37:09","modified_gmt":"2024-01-31T21:37:09","slug":"accelerated-database-recovery-enhancements-in-sql-server-2022","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2023\/03\/28\/accelerated-database-recovery-enhancements-in-sql-server-2022\/","title":{"rendered":"Accelerated Database Recovery enhancements in SQL Server 2022\u00a0"},"content":{"rendered":"\n
Part of the <\/em>SQL Server 2022 blog series<\/em><\/a>. <\/p>\n\n\n\n We are excited to share that there are several Accelerated Database Recovery (ADR) enhancements in SQL Server 2022<\/a> that further improve the overall availability and scalability of the database, primarily around persistent version store (PVS) cleanup and management.<\/p>\n\n\n\n ADR improves database availability, especially in the presence of long running transactions, by redesigning the SQL database engine recovery process. ADR is introduced in SQL Server 2019 (15.x) and improved in SQL Server 2022 (16.x). <\/p>\n\n\n\n ADR is also available for databases in Azure SQL Database, Azure SQL Managed Instance, and Azure Synapse SQL. ADR is enabled by default in SQL Database and SQL Managed Instance and cannot be disabled. <\/p>\n\n\n\n The primary benefits of Accelerated Database Recovery (ADR) are<\/p>\n\n\n\n With ADR, long running transactions do not impact the overall recovery time, enabling fast and consistent database recovery irrespective of the number of active transactions in the system or their sizes. <\/p>\n\n\n\n With ADR, transaction rollback is instantaneous, irrespective of the time that the transaction has been active or the number of updates that has performed. <\/p>\n\n\n\n With ADR, the transaction log is aggressively truncated, even in the presence of active long running transactions, which prevents it from growing out of control. <\/p>\n\n\n\n ADR completely redesigns the database engine recovery process.<\/p>\n\n\n\n At a high level, ADR achieves fast database recovery by versioning all physical database modifications and only undoing logical operations, which are limited and can be undone almost instantly. Any transactions that were active at the time of a crash are marked as aborted and, therefore, any versions generated by these transactions can be ignored by concurrent user queries.<\/p>\n<\/div>\n\n\n\n Note<\/strong>: For more details about ADR, please visit this page<\/a>: and this video<\/a> for a high-level overview of ADR and its components.<\/p>\n\n\n Learn about the new features on security, platform, management, and more.<\/p>\n\t\t\t\t\t<\/div>\n\n\t\t\t\t\t\t\t\t\t\t\t In SQL Server 2019 (15.x), the ADR cleanup process is single threaded within a SQL Server instance. Beginning with SQL Server 2022 (16.x), this process uses multi-threaded version cleanup (MTVC), that allows multiple databases under the same SQL Server instance to be cleaned in parallel. <\/p>\n\n\n\n MTVC is enabled by default in SQL Server 2022 and uses one thread per SQL instance. To adjust the number of threads for version cleanup, set ADR Cleaner Thread Count with In the above example, if you configure the ADR Cleaner Count to be four on a sql instance with two databases, the ADR cleaner will allocate only one thread per database, leaving the remaining two threads idle.<\/p>\n\n\n\n Note<\/strong>: The maximum number of ADR Cleaner threads is capped at the number of cores used by the SQL Server instance. For example, if you are running SQL Server on an eight core machine, the maximum number of ADR cleaner threads that the engine can use will be eight, even if the value in the This improvement allows user transactions to run cleanup on pages that could not be addressed by the regular cleanup process due to lock conflicts. This helps ensure that the ADR cleanup process works more efficiently.<\/p>\n\n\n\n This improvement tracks persisted version store (PVS) pages at the extent level, in order to reduce the memory footprint needed to maintain versioned pages.<\/p>\n\n\n\n ADR cleaner has improved version cleanup efficiencies to improve how SQL Server tracks and records aborted versions of a page leading to improvements in memory and capacity.<\/p>\n\n\n\n This improvement allows ADR to clean up versions belonging to committed transactions independent of whether there are aborted transactions in the system. With this improvement PVS pages can be deallocated, even if the cleanup cannot complete a successful sweep to trim the aborted transaction map.<\/p>\n\n\n\n The result of this improvement is reduced PVS growth even if ADR cleanup is slow or fails.<\/p>\n\n\n\n A new extended event, In this blog post, we covered all the exciting ADR improvements that we are including with SQL Server 2022 that further improve the overall availability and scalability of your databases.<\/p>\n\n\n Stay tuned as we are currently working on further improvements of the multi-threaded version cleaner that will enable parallelizing version cleanup within databases.<\/p>\n\n\n\n For more information, and to get started with SQL Server 2022<\/a>, check out the following references: <\/p>\n\n\n\nOverview of Accelerated Database Recovery (ADR) <\/h2>\n\n\n\n
Fast and consistent database recovery <\/h3>\n\n\n\n
Instantaneous transaction rollback <\/h3>\n\n\n\n
Aggressive log truncation <\/h3>\n\n\n\n
\n
\t\t\t\t<\/div>\n\t\t\t\n\t\t\tSQL Server 2022<\/h2>\n\n\t\t\t\t\t
New ADR improvements in SQL Server 2022 <\/h2>\n\n\n\n
Multi-threaded version cleanup<\/h3>\n\n\n\n
sp_configure<\/code>. <\/p>\n\n\n\nUSE master;\nGO\n-- Enable show advanced option to see ADR Cleaner Thread Count\nEXEC sp_configure 'show advanced option', '1';\n-- List all advanced options\nRECONFIGURE;\nEXEC sp_configure;\u00a0\n-- The following example sets the ADR Cleaner Thread Count to 4\nEXEC sp_configure 'ADR Cleaner Thread Count', '4';\nRECONFIGURE WITH OVERRIDE;\u00a0\n-- Run RECONFIGURE to verify the number of threads allocated to ADR Version Cleaner.\nRECONFIGURE;\nEXEC sp_configure;\n<\/pre><\/div>\n\n\n
sp_configure<\/code> is set to a greater value. <\/p>\n\n\n\nUser transaction cleanup<\/h3>\n\n\n\n
Reducing memory footprint for PVS page tracker<\/h3>\n\n\n\n
Accelerated Data Recovery cleaner improvements<\/h3>\n\n\n\n
Transaction-level persisted version store<\/h3>\n\n\n\n
New extended event<\/h3>\n\n\n\n
tx_mtvc2_sweep_stats<\/code>, has been added for telemetry on the ADR PVS multi-threaded version cleaner.<\/p>\n\n\n\nSummary<\/h2>\n\n\n\n

Learn more<\/h2>\n\n\n\n