Music Show miscellaneous-split pages 2

Source: Internet
Author: User

In the previous music show, the page split was tested based on SQL Server 2008. in SQL Server 2012 and SQL Server 2014, the page split was optimized, this prevents multiple page splits caused by one insert operation.

Let's test it in SQL Server 2014:

-- ===================================================== ==-- Use the testdb database to test use testdbgodrop table tb01go -- ====================== ============ -- create a test table tb01create table tb01 (ID int primary key, c1 nvarchar (max )) go -- ============================================== = -- insert 420 data records, insert into tb01 (ID, C1) Select T. RID, N 'c' from (select row_number () over (order by object_id) as RID from sys. all_columns) as twhere T. rid <422and T. rid <> 418 -- ========================================== = -- = insert into tb01 (ID, c1) Select 418, replicate (n'1', 4000) -- ======================================================= -- View data page DBCC Ind ('testdb ', 'tb01', 1)

-- =======================================================-- View non-leaf DBCC page ('testdb ',, 3)

We can see that this split only creates two new pages. When the records with ID = 418 are inserted, we find that the new records cannot be stored on page 8012, so we split page 8012, leave the data before 418 on page 8012, put the data after 418 on the new page 8105, and then apply for another page to store the id = 418 record to be inserted.

 

In SQL Server 2012 and SQL Server 2014, when a page is split for the first time and new data rows cannot be inserted, a new page is created to store the record, to avoid multiple page splits. (I do not know which algorithm is used for the first page split)

 

-- ===================================================== =====

 

Music Show miscellaneous-split pages 2

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.