<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>fill factor - Techyaz.com</title>
	<atom:link href="https://techyaz.com/tag/fill-factor/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Tips, Tutorials and How-to Topics</description>
	<lastBuildDate>Fri, 01 Jun 2018 12:39:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8</generator>

<image>
	<url>https://techyaz.com/wp-content/uploads/2017/11/cropped-Site-icon-150x150.png</url>
	<title>fill factor - Techyaz.com</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Avoid Page Split in SQL Server?</title>
		<link>https://techyaz.com/sql-server/how-to-avoid-page-split-in-sql-server/</link>
					<comments>https://techyaz.com/sql-server/how-to-avoid-page-split-in-sql-server/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Tue, 14 Nov 2017 12:48:59 +0000</pubDate>
				<category><![CDATA[Indexes]]></category>
		<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[fill factor]]></category>
		<category><![CDATA[index rebuild]]></category>
		<category><![CDATA[Page Split]]></category>
		<category><![CDATA[SQL Server Indexes]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1130</guid>

					<description><![CDATA[<p>This is very interesting topic. How to Avoid Page Split in SQL Server? Let&#8217;s start with basics. Page split is a resource intensive operation and causes fragmentation that leads to poor performance in terms of increased I/O operations. We should&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/how-to-avoid-page-split-in-sql-server/">How to Avoid Page Split in SQL Server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This is very interesting topic. How to Avoid Page Split in SQL Server? Let&#8217;s start with basics. Page split is a resource intensive operation and causes <a href="https://techyaz.com/sql-server/difference-index-rebuild-reorganize/" target="_blank" rel="noopener">fragmentation</a> that leads to poor performance in terms of increased I/O operations. We should take it seriously if  there are frequent page splits occur and consider to reduce its occurrences.  Here, i will explain how to check Page Split in SQL Server and how to reduce Page Split and its occurrence.</p>
<h3><span style="color: #333399;">What is Page Split?</span></h3>
<p>Whenever you update existing rows with the data that is bigger in size to save on their data page then Page Split operation occur to make space for this new update. Data from existing data page first move to new page that is added during Page Split operation and make room to accommodate new records. That is why this operation is resource intensive and create fragmentation. Page splits only occur when data changes in the database. If you are adding all your data at the end of the table then page split will not occur.</p>
<p>If your fill factor is 100 or 0, it will work in a same way. That means there is no room in leaf level page to accommodate future updates. Setting fill factor value to 0 or 100 will increase page split occurrences.</p>
<h3><span style="color: #333399;">How to Check Page Split in SQL Server?</span></h3>
<p>Here, i will explain how to check page split in SQL Server. Whenever Page split occurs, it will be logged in transaction log file as <strong>LOP_DELETE_SPLIT </strong>operation. We use <em>fn_dblog</em> function to read SQL Server transaction log file. Run below T-SQL code to see all page splits occurrence using transaction log file.</p>
<pre class="brush: sql; title: ; notranslate" title=""><strong><span style="color: #0000ff;">SELECT *
FROM
fn_dblog (NULL, NULL)
WHERE
[Operation] = N'LOP_DELETE_SPLIT'
</span></strong></pre>
<p>You can see LOP_DELETE_SPLIT is logged under operations column. That means it&#8217;s a page split operation.</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-1143" src="http://techyaz.com/wp-content/uploads/2017/11/LOP_DELETE_SPLIT.jpg" alt="page split using fn_dblog" width="654" height="347" srcset="https://techyaz.com/wp-content/uploads/2017/11/LOP_DELETE_SPLIT.jpg 654w, https://techyaz.com/wp-content/uploads/2017/11/LOP_DELETE_SPLIT-300x159.jpg 300w" sizes="(max-width: 654px) 100vw, 654px" /></p>
<p><a href="https://www.sqlskills.com/blogs/paul/tracking-page-splits-using-the-transaction-log/" target="_blank" rel="noopener">Paul Randel</a> has given very good sql code to check total number of page splits occurrence. Below is the code you need to run to get this details.</p>
<pre class="brush: sql; title: ; notranslate" title=""><strong><span style="color: #0000ff;">SELECT
[AllocUnitName] AS N'Index',
(CASE [Context]
WHEN N'LCX_INDEX_LEAF' THEN N'Nonclustered'
WHEN N'LCX_CLUSTERED' THEN N'Clustered'
ELSE N'Non-Leaf'
END) AS [SplitType],
COUNT (1) AS [SplitCount]
FROM
fn_dblog (NULL, NULL)
WHERE
[Operation] = N'LOP_DELETE_SPLIT'
GROUP BY [AllocUnitName], [Context];
GO
</span></strong></pre>
<p>You can check total number of page splits are shown for each indexes in below screenshot. Now we will discuss how to avoid page split in SQL Server for such indexes.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1144" src="http://techyaz.com/wp-content/uploads/2017/11/page-split-occurance.jpg" alt="Total number of page splits" width="553" height="421" srcset="https://techyaz.com/wp-content/uploads/2017/11/page-split-occurance.jpg 553w, https://techyaz.com/wp-content/uploads/2017/11/page-split-occurance-300x228.jpg 300w" sizes="(max-width: 553px) 100vw, 553px" /></p>
<h3><span style="color: #333399;">How to Reduce Page Split Occurrences?</span></h3>
<p>An <a href="https://techyaz.com/sql-server/understanding-sql-server-indexes/" target="_blank" rel="noopener">index</a> that has many random inserts and has very full pages will have an increased number of page splits. This causes more fragmentation and that is very bad for performance. We can reduce page splits by keeping some room in the data pages by setting fill factor value less than 100. The extra bytes on each page will help to minimize page splits caused by extra length in the rows. Read attached article to understand <a href="https://techyaz.com/sql-server/what-should-be-the-best-value-for-fill-factor-in-sql-server/" target="_blank" rel="noopener">the best value for fill factor</a> to avoid such page-split operations.</p>
<p>We can also use <a href="https://techyaz.com/sql-server/difference-index-rebuild-reorganize/" target="_blank" rel="noopener">index rebuild operation</a> with the <a href="https://techyaz.com/sql-server/what-should-be-the-best-value-for-fill-factor-in-sql-server/" target="_blank" rel="noopener">FILL FACTOR</a> option that will allow the page fullness to be changed to fit the query pattern on the index. This will also helpful in reducing total page-split counts.<br />
I hope you like this article. You can drop your questions in comment section. Please follow our <a href="https://www.facebook.com/Techyaz/">Facebook</a> page and <a href="https://twitter.com/Tech_yaz">Twitter</a> handle to get latest updates.</p>
<p>The post <a href="https://techyaz.com/sql-server/how-to-avoid-page-split-in-sql-server/">How to Avoid Page Split in SQL Server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/how-to-avoid-page-split-in-sql-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What should be the Best Value for Fill Factor in SQL Server</title>
		<link>https://techyaz.com/sql-server/indexes/what-should-be-the-best-value-for-fill-factor-in-sql-server/</link>
					<comments>https://techyaz.com/sql-server/indexes/what-should-be-the-best-value-for-fill-factor-in-sql-server/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Fri, 10 Nov 2017 11:47:04 +0000</pubDate>
				<category><![CDATA[Indexes]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Clustered Index]]></category>
		<category><![CDATA[fill factor]]></category>
		<category><![CDATA[Index]]></category>
		<category><![CDATA[Nonclustered Index]]></category>
		<category><![CDATA[SQL Server Indexes]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1125</guid>

					<description><![CDATA[<p>Lot of SQL Server resources ask what is the best value for fill factor in SQL Server and should we change its value from default to some other value? On high level, generally we should not change fill factor value&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/indexes/what-should-be-the-best-value-for-fill-factor-in-sql-server/">What should be the Best Value for Fill Factor in SQL Server</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Lot of SQL Server resources ask what is the best value for fill factor in SQL Server and should we change its value from default to some other value? On high level, generally we should not change fill factor value from its default value but you should analyze the history and based on its fragmentation frequency you can take the call. Here, I will show you how to check fill factor in SQL Server and also its best value that you should keep in your database.</p>
<p>A fill factor value determines the percentage of space on each leaf-level page to be filled with data, reserving the remainder on each page as free space for future growth. For example, If we specify a fill factor value of 95 means that 5% of each leaf-level page will be left empty, providing space for future index expansion as data is added to the underlying table. The empty space is reserved between the <a href="https://techyaz.com/sql-server/understanding-sql-server-indexes/" target="_blank" rel="noopener">index</a> rows rather than at the end of the index.</p>
<p>Fill factor values 0 and 100 are the same in all respects. The fill-factor option is provided for fine-tuning index data storage and performance. Setting inappropriate fillfactor value will increase the page split occurrence that is not good from SQL Server performance point of view. A correctly chosen value can reduce potential page splits by providing enough space for index expansion.</p>
<p>Although, there is no defined value that we can say is perfect value for fill factor. You can set it to somewhere around 80% and monitor fragmentation over time. Then, you can tweak its value up or down depending on how fragmented the indexes get.</p>
<p>There is a myth that Database engine considers fill factor value during every INSERT or UPDATE transaction. But it&#8217;s not true. Database engine does not consider fill factor value during normal DML (insert / update / delete) operations. This value comes into picture only during index creation or rebuild operation. So whenever you insert or load data in your database data pages will be filled 100% irrespective of your fill-factor value.</p>
<h3><span style="color: #333399;">How to specify a fill factor in an index by using GUI in SSMS</span></h3>
<ol>
<li>Connect to <strong>SQL Server Instance</strong> using SSMS.</li>
<li>Expand <strong>Database</strong> folder followed by the <strong>database that contains the table</strong> on which you want to specify an index’s fill factor.</li>
<li>Expand the <strong>Tables </strong>folder.</li>
<li>Click the plus sign to expand the table on which you want to specify an index fill-factor.</li>
<li>Click the plus sign to expand the <strong>Indexes</strong></li>
<li>Right-click the index with the fill factor that you want to specify and select <strong>Properties</strong>.</li>
<li>Under <strong>Select a page</strong>, select <strong>Options</strong>.</li>
<li>In the <strong>Fill factor </strong>row, enter the fill factor that you want.</li>
<li>Click <strong>OK</strong>.</li>
</ol>
<p>You can check fill factor value in below screenshot as well. Fill factor value is showing zero because of its default value. Change it for this particular index if you want.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1138" src="http://techyaz.com/wp-content/uploads/2017/11/fill-factor.jpg" alt="fill factor" width="854" height="530" srcset="https://techyaz.com/wp-content/uploads/2017/11/fill-factor.jpg 854w, https://techyaz.com/wp-content/uploads/2017/11/fill-factor-300x186.jpg 300w, https://techyaz.com/wp-content/uploads/2017/11/fill-factor-768x477.jpg 768w" sizes="(max-width: 854px) 100vw, 854px" /></p>
<h3><span style="color: #333399;"><strong>How to specify a fill factor in an index using Transact-SQL</strong></span></h3>
<p>We can determine fill factor either during <a href="https://techyaz.com/sql-server/difference-index-rebuild-reorganize/" target="_blank" rel="noopener">Index REBUILD operation</a> or during Index creation. Below is the T-SQL codes that we can use to specify fill factor for an index.</p>
<p><strong>To specify a fill factor in an existing index</strong></p>
<p>Run below T-SQL command to determine fill factor for an existing index during Rebuild operation.</p>
<pre class="brush: sql; title: ; notranslate" title=""><strong><span style="color: #008000;">-- Rebuilds the IX_Salary_EMPID index with a fill-factor of 95 on the dbo.Salary table.</span></strong>
<span style="color: #0000ff;"><strong>USE Techyaz
GO

ALTER INDEX IX_Salary_EMPID ON dbo.Salary
REBUILD WITH (<span style="color: #ff0000;">FILLFACTOR = 95</span>);
GO
</strong></span></pre>
<p><strong>To specify a fill-factor during create index</strong></p>
<p>Run below command to specify a fill-factor during index creation.</p>
<pre class="brush: sql; title: ; notranslate" title=""><span style="color: #008000;"><strong>--Drops and re-creates the IX_Salary_EMPID index on the dbo.Salary table with a fill-factor of 95.</strong></span>
<strong><span style="color: #0000ff;">USE Techyaz;
GO

CREATE INDEX IX_Salary_EMPID ON dbo.Salary
(EMPID)
WITH (DROP_EXISTING = ON, <span style="color: #ff0000;">FILLFACTOR = 95</span>);
GO
</span></strong></pre>
<p><em><span style="color: #800000;"><strong>Related Articles</strong></span></em></p>
<ul>
<li><strong><a href="https://techyaz.com/sql-server/understanding-sql-server-indexes/" target="_blank" rel="noopener">Understanding SQL Server Indexes</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/difference-index-rebuild-reorganize/" target="_blank" rel="noopener">What is difference between Rebuild and Reorganize Indexes?</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/troubleshooting/table-row-count-showing-incorrect-value-sys-partitions-dmv-sys-dm_db_partition_stats/" target="_blank" rel="noopener">Table Row Count is showing incorrect in sys.partitions</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/get-row-counts-tables-database/" target="_blank" rel="noopener">How to get Total Row Count of all tables of a database</a></strong></li>
</ul>
<p>I hope you like this article. Drop your questions and feedbacks in comment section. Please follow our <a href="https://www.facebook.com/Techyaz/">Facebook</a> page and <a href="https://twitter.com/Tech_yaz">Twitter </a>handle to get latest updates.</p>
<p>The post <a href="https://techyaz.com/sql-server/indexes/what-should-be-the-best-value-for-fill-factor-in-sql-server/">What should be the Best Value for Fill Factor in SQL Server</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/indexes/what-should-be-the-best-value-for-fill-factor-in-sql-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
