What is the in-flight log in SQL Server?

Source: Internet
Author: User
Tags commit log

In SQL Server, the Wal of the log is used to guarantee the persistence of relational databases, but because of the characteristics of the hard disk, it is not possible to write each log directly to disk once, so the log is cached to a certain amount of data before it is written to disk. This part of the generated, but not written to disk log, is called the in-flight log.

In SQL Server, the size of the in-flight log depends on two factors, and according to Paul Randal, the in-flight log cannot exceed 60K, so the maximum in-flight log is 60K, in addition, If the in-flight log does not reach 60K, if a commit or rollback occurs, the disk is written directly. So the log minimum is 512 bytes, the maximum is 60K, and it grows in 512 bytes. Let's take a look at the example below.

Let's start by creating a simple table that loops into 10W of data, which generates a lot of logs, as shown in Listing 1:

Begin TRAN
     
DECLARE @i INTEGER
     
SET @i = 0 while
     
(@i < 100000) 
    begin
     
        Inserts
        into number VAL UES  (@i)
     
        SET @i = @i + 1
    end
     
CHECKPOINT
     
COMMIT

Code Listing 1. Statements that generate a large number of logs

The database I start with a 5M log and increment in 5M, and the above statement causes the log to grow automatically, as shown in Figure 1.

Figure 1 The corresponding 6 log growth

Related Article

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.