SQL Server 2019 ADR : Use more transaction log to rollback

sakuraime 2,326 Reputation points
2021-07-23T07:56:19.593+00:00

I understand the mdf of the database which enabled ADR will increase due to versioning of the extent. However , I found when rollback, it takes much transaction log space. why ?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,817 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Seeya Xi-MSFT 16,471 Reputation points
    2021-07-23T09:10:32.263+00:00

    Hi @sakuraime ,

    There are many reasons, but usually these reasons are of the following several patterns:

    -The database recovery model is not a simple model, but no log backups are scheduled. For databases in non-simple mode, the records will be truncated only after the log backup is done.
    -There is a transaction on the database that has not been committed for a long time. SQL Server will retain all log records from the point in time when this transaction is started.
    -There is a large transaction running on the database. For example, a user is creating/rebuilding indexes, or deleting or inserting large amounts of data with DELETE/INSERT statements.

    Best regards,
    Seeya


    If the response is helpful, please click "Accept Answer" and upvote it, as this could help other community members looking for similar queries.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Erland Sommarskog 111.4K Reputation points MVP
    2021-07-25T20:33:21.453+00:00

    Sorry, I was not able to reproduce the observation. I ran this script:

    USE tempdb
    go
    DROP DATABASE IF EXISTS A
    go
    CREATE DATABASE A
    ALTER DATABASE A SET RECOVERY SIMPLE
    -- ALTER DATABASE A SET ACCELERATED_DATABASE_RECOVERY = ON
    go
    USE A
    go
    create table big (col1 varchar(1000))
    go
    
    insert into big values (replicate('A',1000))
    go 100000
    
    EXEC sp_helpdb A
    go
    begin tran
    update big set col1=replicate('B',1000)
    
    EXEC sp_helpdb A
    
    go
    ROLLBACK TRANSACTION
    go
    EXEC sp_helpdb A
    go
    WAITFOR DELAY '00:00:10'
    go
    EXEC sp_helpdb A
    

    And then the same batch with the comment removed. The final file sizes in the first case was 139264 KB for the data file and 401408 KB for the log file. In the second case, the numbers were 270336 KB and 401408 KB.

    That is, the data file was bigger (because of the Perisistent Version Store), but the log-file size was the same.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.