Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you measure SQL Fill Factor value

Usually when I'm creating indexes on tables, I generally guess what the Fill Factor should be based on an educated guess of how the table will be used (many reads or many writes).

Is there a more scientific way to determine a more accurate Fill Factor value?

like image 425
GateKiller Avatar asked Aug 14 '08 12:08

GateKiller


People also ask

What is the best value for fill factor in SQL Server?

Static Tables – Set Fill Factor at 100 (or default server fill factor), As these tables are never changing, keeping the Fill Factor at 100 is the best option. They conserve the space, and also there is no fragmentation.

What is fill factor?

Fill factor (FF) is the ratio of the actual maximum obtainable power, represented by the dark blue box, to the product of short circuit current Is/c and open circuit voltage Vo/c, represented by the light blue box.

What is the default index fill factor?

The default value of the Fill Factor is 100, which is same as value 0. The default Fill Factor (100 or 0) will allow the SQL Server to fill the leaf-level pages of an index with the maximum numbers of the rows it can fit. There will be no or very little empty space left in the page, when the fill factor is 100.


2 Answers

You could try running a big list of realistic operations and looking at IO queues for the different actions.

There are a lot of variables that govern it, such as the size of each row and the number of writes vs reads.

Basically: high fill factor = quicker read, low = quicker write.

However it's not quite that simple, as almost all writes will be to a subset of rows that need to be looked up first.

For instance: set a fill factor to 10% and each single-row update will take 10 times as long to find the row it's changing, even though a page split would then be very unlikely.

Generally you see fill factors 70% (very high write) to 95% (very high read).

It's a bit of an art form.

I find that a good way of thinking of fill factors is as pages in an address book - the more tightly you pack the addresses the harder it is to change them, but the slimmer the book. I think I explained it better on my blog.

like image 132
Keith Avatar answered Oct 12 '22 15:10

Keith


I would tend to be of the opinion that if you're after performance improvements, your time is much better spent elsewhere, tweaking your schema, optimising your queries and ensuring good index coverage. Fill factor is one of those things that you only need to worry about when you know that everything else in your system is optimal. I don't know anyone that can say that.

like image 25
ninesided Avatar answered Oct 12 '22 16:10

ninesided