SQL Server Myth: Error about fill factor

Source: Internet
Author: User
Tags create database

Mistaken idea #25: Several mistaken ideas about filling factor

It's all wrong.

25a) filling factor is always present.

No, through Books Online you can see (translator: I did not find this phrase in the new version of BOL):

Important: The fill factor only takes effect when an index is created or rebuilt, and the SQL Server storage engine does not always keep the free values and fill factors in the page consistent. The padding factor is meaningless if you want to keep the free values in the page and the fill factor that you specify. This is because the page needs to be paged even if it is dissatisfied.

Fill factor 0 and 100 are different

Error, by Bol a sentence can be seen

Filling factors 0 and 100 are all in one sense.

c) Fill factor set to 0 will reserve space on non-leaf nodes

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/database/SQLServer/

This is wrong, this point Bol did not say, I do not know where this misunderstanding came from, but this is absolutely wrong. You can verify this by using the following code:

CREATE DATABASE foo; 
Go use 
foo; 
Go 
CREATE TABLE T1 (C1 INT 
IDENTITY, C2 CHAR (1000) DEFAULT ' a '); 
CREATE CLUSTERED INDEX t1c1 on T1 
(C1); 
Go 
SET NOCOUNT on; 
Go 
inserts into T1 DEFAULT VALUES; 

Go 10000

Next, set the fill factor to 0 and rebuild the index

SELECT [Fill_factor] from sys.indexes WHERE NAME = ' t1c1 ' and [object_id] = object_id (' t1 '); Go ALTER INDEX t1c1 on T1 REBUILD with (FILLFACTOR = 100); Go

After the code above executes, view the value of the M_FREECNT column in the established page, which is the value of the free space in the page:

EXEC sp_allocationmetadata ' T1 ';   Go DBCC traceon (3604); DBCC PAGE (foo, 1, 164, 3); --The root page, from the SP output Go DBCC page (foo, 1, 162, 1); --the page ID in the DBCC page output above go

With the above code you can see that the value is 10, which means that there is no space reserved in the industry. At this time a misunderstanding, about the above Sp_allocationmetadata implementation details please see this blog post.

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.