Database Reference
In-Depth Information
Another process, page merging , occurs when a delete operation leaves an index page less than 10% from the
maximum page size, which is 8KB now, or when an index page contains just a single row.
Let's assume that we have a page layout as shown in Figure 32-13 , and we want to delete the index key value Bob ,
which means that all data rows with the name Bob have been deleted. In our example, this leaves an index page with
the single value Boris , which triggers page merging.
In the first step, SQL Server creates a delete delta record for Bob and another special kind of delta record called
merge delta . Figure 32-14 illustrates the layout after the first step.
Figure 32-14. Page merging: First step
During the second step of page merging, SQL Server creates a new internal page that does not reference the
page with which it is about to merge. After that, SQL Server switches the mapping table to point to the newly created
internal page and marks the old page for garbage collection. Figure 32-15 illustrates this action.
Figure 32-15. Page merging: Second step
Finally, SQL Server builds a new leaf-level page, copying the Boris value there. After the new page is created,
it updates the mapping table and marks the old pages and delta records for garbage collection.
Figure 32-16 shows the final data layout after page merging is completed.
 
Search WWH ::




Custom Search