<?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>Fillfactor &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/fillfactor/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Wed, 11 Oct 2017 11:52:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Server: Configure Fill factor for Index and Server Instance</title>
		<link>https://www.dbrnd.com/2017/01/sql-server-configure-fill-factor-for-index-and-server-instance/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 01 Jan 2017 15:11:34 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Fillfactor]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2396</guid>

					<description><![CDATA[In the previous post, I have explained basic about the SQL Server Fillfactor. SQL Server: Index Performance Tuning with the Fill Factor In this post, I am going to share some scripts to configure Fill Factor for Index and SQL Server Instance. Check the default Fillfactor value for SQL Server Instance: [crayon-6a8f011d8febb739338715/] Change the SQL [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-configure-fill-factor-for-index-and-server-instance%2F&amp;linkname=SQL%20Server%3A%20Configure%20Fill%20factor%20for%20Index%20and%20Server%20Instance" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-configure-fill-factor-for-index-and-server-instance%2F&amp;linkname=SQL%20Server%3A%20Configure%20Fill%20factor%20for%20Index%20and%20Server%20Instance" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-configure-fill-factor-for-index-and-server-instance%2F&amp;linkname=SQL%20Server%3A%20Configure%20Fill%20factor%20for%20Index%20and%20Server%20Instance" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-configure-fill-factor-for-index-and-server-instance%2F&amp;linkname=SQL%20Server%3A%20Configure%20Fill%20factor%20for%20Index%20and%20Server%20Instance" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-configure-fill-factor-for-index-and-server-instance%2F&amp;linkname=SQL%20Server%3A%20Configure%20Fill%20factor%20for%20Index%20and%20Server%20Instance" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-configure-fill-factor-for-index-and-server-instance%2F&amp;linkname=SQL%20Server%3A%20Configure%20Fill%20factor%20for%20Index%20and%20Server%20Instance" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-configure-fill-factor-for-index-and-server-instance%2F&#038;title=SQL%20Server%3A%20Configure%20Fill%20factor%20for%20Index%20and%20Server%20Instance" data-a2a-url="https://www.dbrnd.com/2017/01/sql-server-configure-fill-factor-for-index-and-server-instance/" data-a2a-title="SQL Server: Configure Fill factor for Index and Server Instance"></a></p><p>In the previous post, I have explained basic about the SQL Server Fillfactor. </p>
<blockquote class="wp-embedded-content" data-secret="4GeNvJPZ2o"><p><a href="https://www.dbrnd.com/2016/12/sql-server-index-performance-tuning-with-the-fill-factor/">SQL Server: Index Performance Tuning with the Fill Factor</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/12/sql-server-index-performance-tuning-with-the-fill-factor/embed/#?secret=4GeNvJPZ2o" data-secret="4GeNvJPZ2o" width="600" height="338" title="&#8220;SQL Server: Index Performance Tuning with the Fill Factor&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>In this post, I am going to share some scripts to configure Fill Factor for Index and SQL Server Instance. </p>
<p><strong>Check the default Fillfactor value for SQL Server Instance:<br />
</strong></p>
<pre class="crayon-plain-tag">SELECT *
FROM sys.configurations
WHERE name ='fill factor (%)'</pre> </p>
<p><strong>Change the SQL Server default Fillfactor from (0 or 100) to 80:<br />
</strong></p>
<pre class="crayon-plain-tag">sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'fill factor', 80;
GO
RECONFIGURE;
GO</pre> </p>
<p><strong>Check the Fillfactor value for Indexes:</strong></p>
<pre class="crayon-plain-tag">SELECT 
	OBJECT_NAME(OBJECT_ID) Name
	,type_desc
	,fill_factor
FROM sys.indexes</pre> </p>
<p><strong>Create new Index with Fillfactor option: </strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_TestFillFactor
(
	ID INTEGER PRIMARY KEY
	,Name VARCHAR(50)
)
GO
CREATE NONCLUSTERED INDEX idx_TestFillFactor 
ON tbl_TestFillFactor(Name) WITH (FillFactor = 80)
GO</pre> </p>
<p><strong>Alter existing Index to change Fillfactor value: </strong></p>
<pre class="crayon-plain-tag">ALTER INDEX idx_TestFillFactor ON tbl_TestFillFactor
REBUILD WITH (FILLFACTOR = 90)
GO</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Script to check a Fillfactor value for Tables and Indexes</title>
		<link>https://www.dbrnd.com/2016/03/postgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes/</link>
					<comments>https://www.dbrnd.com/2016/03/postgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 31 Mar 2016 20:01:44 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[PostgreSQL DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Fillfactor]]></category>
		<category><![CDATA[indexes]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[tables]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2180</guid>

					<description><![CDATA[In this post, I am sharing a script to check a Fillfactor value, for tables or indexes of PostgreSQL Database Server. I have already published importance of Fillfactor in PostgreSQL. When we are working with the large database system, and we set Fillfactor value of multiple objects, sometimes it is required to check the value [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&#038;title=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" data-a2a-url="https://www.dbrnd.com/2016/03/postgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes/" data-a2a-title="PostgreSQL: Script to check a Fillfactor value for Tables and Indexes"></a></p><p>In this post, I am sharing a script to check a Fillfactor value, for tables or indexes of PostgreSQL Database Server. </p>
<p><a href="https://www.dbrnd.com/2016/03/postgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement/" target="_blank"><strong>I have already published importance of Fillfactor in PostgreSQL. </strong></a></p>
<blockquote><p>When we are working with the large database system, and we set Fillfactor value of multiple objects, sometimes it is required to check the value of current Fillfactor for those objects. </p></blockquote>
<p>I prepared one script with &#8220;reloptions&#8221; column in which you can find &#8220;{fillfactor=value}&#8221; if it is assigned then only otherwise it is NULL. </p>
<pre class="crayon-plain-tag">SELECT 
	pc.relname AS ObjectName 
       ,pc.reloptions AS ObjectOptions
FROM pg_class AS pc
INNER JOIN pg_namespace AS pns 
	ON pns.oid = pc.relnamespace
WHERE pns.nspname = 'public'
	AND pc.relname = 'Table_Name';</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/03/postgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: ALTER TABLE to change Fillfactor Value</title>
		<link>https://www.dbrnd.com/2016/03/postgresql-alter-table-to-change-fillfactor-value/</link>
					<comments>https://www.dbrnd.com/2016/03/postgresql-alter-table-to-change-fillfactor-value/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 30 Mar 2016 04:30:54 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[alter]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Fillfactor]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2183</guid>

					<description><![CDATA[This is one of the important post related to change or set the Fillfactor value for the existing table of the PostgreSQL. One of our tables is very busy with a large number of updates and access by multiple clients. I also estimated the row size of that table which is not that much bigger, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-alter-table-to-change-fillfactor-value%2F&amp;linkname=PostgreSQL%3A%20ALTER%20TABLE%20to%20change%20Fillfactor%20Value" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-alter-table-to-change-fillfactor-value%2F&amp;linkname=PostgreSQL%3A%20ALTER%20TABLE%20to%20change%20Fillfactor%20Value" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-alter-table-to-change-fillfactor-value%2F&amp;linkname=PostgreSQL%3A%20ALTER%20TABLE%20to%20change%20Fillfactor%20Value" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-alter-table-to-change-fillfactor-value%2F&amp;linkname=PostgreSQL%3A%20ALTER%20TABLE%20to%20change%20Fillfactor%20Value" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-alter-table-to-change-fillfactor-value%2F&amp;linkname=PostgreSQL%3A%20ALTER%20TABLE%20to%20change%20Fillfactor%20Value" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-alter-table-to-change-fillfactor-value%2F&amp;linkname=PostgreSQL%3A%20ALTER%20TABLE%20to%20change%20Fillfactor%20Value" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-alter-table-to-change-fillfactor-value%2F&#038;title=PostgreSQL%3A%20ALTER%20TABLE%20to%20change%20Fillfactor%20Value" data-a2a-url="https://www.dbrnd.com/2016/03/postgresql-alter-table-to-change-fillfactor-value/" data-a2a-title="PostgreSQL: ALTER TABLE to change Fillfactor Value"></a></p><p>This is one of the important post related to change or set the Fillfactor value for the existing table of the PostgreSQL. </p>
<blockquote><p>One of our tables is very busy with a large number of updates and access by multiple clients.</p>
<p>I also estimated the row size of that table which is not that much bigger, so I decided to change the Fillfactor of that table. </p></blockquote>
<p><a href="https://www.dbrnd.com/2016/03/postgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement/" target="_blank"><strong>I have recently published an article about the importance of Fillfactor in PostgreSQL. </strong></a></p>
<pre class="crayon-plain-tag">ALTER TABLE table_name SET ( fillfactor = 50);
VACUUM FULL table_name;</pre> </p>
<p><strong>Please Note:</strong></p>
<blockquote><p>After changing the value of Fillfactor, you should execute VACUUM FULL on that particular table.<br />
After changing the value of Fillfactor, it works only for new tuples.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/03/postgresql-alter-table-to-change-fillfactor-value/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: How to measure the size of a Table Row and Data Page?</title>
		<link>https://www.dbrnd.com/2016/03/postgresql-how-to-measure-the-size-of-a-table-row-and-data-page/</link>
					<comments>https://www.dbrnd.com/2016/03/postgresql-how-to-measure-the-size-of-a-table-row-and-data-page/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 29 Mar 2016 04:35:18 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[PostgreSQL DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Fillfactor]]></category>
		<category><![CDATA[measure]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2193</guid>

					<description><![CDATA[In this post, I am sharing a script to measure the size of a PostgreSQL Table Row. I taken reference from this dba.statckexchange. But again, I would like to share this information with some additional information. Fillfactor storage parameter of PostgreSQL Table. Before changing the default value of Fillfactor, we should measure the size of [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-how-to-measure-the-size-of-a-table-row-and-data-page%2F&amp;linkname=PostgreSQL%3A%20How%20to%20measure%20the%20size%20of%20a%20Table%20Row%20and%20Data%20Page%3F" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-how-to-measure-the-size-of-a-table-row-and-data-page%2F&amp;linkname=PostgreSQL%3A%20How%20to%20measure%20the%20size%20of%20a%20Table%20Row%20and%20Data%20Page%3F" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-how-to-measure-the-size-of-a-table-row-and-data-page%2F&amp;linkname=PostgreSQL%3A%20How%20to%20measure%20the%20size%20of%20a%20Table%20Row%20and%20Data%20Page%3F" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-how-to-measure-the-size-of-a-table-row-and-data-page%2F&amp;linkname=PostgreSQL%3A%20How%20to%20measure%20the%20size%20of%20a%20Table%20Row%20and%20Data%20Page%3F" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-how-to-measure-the-size-of-a-table-row-and-data-page%2F&amp;linkname=PostgreSQL%3A%20How%20to%20measure%20the%20size%20of%20a%20Table%20Row%20and%20Data%20Page%3F" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-how-to-measure-the-size-of-a-table-row-and-data-page%2F&amp;linkname=PostgreSQL%3A%20How%20to%20measure%20the%20size%20of%20a%20Table%20Row%20and%20Data%20Page%3F" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-how-to-measure-the-size-of-a-table-row-and-data-page%2F&#038;title=PostgreSQL%3A%20How%20to%20measure%20the%20size%20of%20a%20Table%20Row%20and%20Data%20Page%3F" data-a2a-url="https://www.dbrnd.com/2016/03/postgresql-how-to-measure-the-size-of-a-table-row-and-data-page/" data-a2a-title="PostgreSQL: How to measure the size of a Table Row and Data Page?"></a></p><p>In this post, I am sharing a script to measure the size of a PostgreSQL Table Row. </p>
<p>I taken reference from this <a href="http://dba.stackexchange.com/questions/23879/measure-the-size-of-a-postgresql-table-row/23933#23933" target="_blank">dba.statckexchange</a>. </p>
<p>But again, I would like to share this information with some additional information. </p>
<p><a href="https://www.dbrnd.com/2016/03/postgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement/" target="_blank"><strong>Fillfactor storage parameter of PostgreSQL Table. </strong></a></p>
<blockquote><p>Before changing the default value of Fillfactor, we should measure the size of Table Row. </p>
<p>For knowing the row size is very important because if table row size is larger, we should not change the default value of Fillfactor.
</p></blockquote>
<blockquote><p>When we are doing performance optimization, this is very important to find the size of the Data page and Table row, otherwise unnecessary we are dealing with high fragmentation and executing VACUUM FULL or VACUUM again and again.
</p></blockquote>
<blockquote><p>If your total row size is under 8kb, you can take decision to alter table storage parameters. </p></blockquote>
<p><strong>Create sample table using JSON data type:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_TestJSON
(
	ID INTEGER PRIMARY KEY
	,DepartName VARCHAR(250)
	,EmployeeDetails JSON
	,Address JSON
);</pre> </p>
<p><strong>Insert few sample JSON formatted record:</strong></p>
<pre class="crayon-plain-tag">INSERT INTO tbl_TestJSON
VALUES 
(
	1
	,'Sales'
	,'{"firstName": "Anvesh", "lastName": "Patel"}'
	,'
	{"address" : 
		{ 
			"India": "Hyderabad"
			,"USA": "Newyork"
		}
	}'
)
,(
	2
	,'Production'
	,'{"firstName": "Neevan", "lastName": "Patel"}'
	,'
	{"address" : 
		{ 
			"India": "Ahmedabad"
			,"USA": "Washington DC"
		}
	}'
)
,(
	3
	,'Animation'
	,'{"firstName": "Eric", "lastName": "Lorn"}'
	,'
	{"address" : 
		{ 
			"India": "Mumbai"
			,"USA": "Chicago"
		}
	}'
);</pre> </p>
<p><strong>Script to measure the size of Table row and Data page:</strong></p>
<pre class="crayon-plain-tag">WITH cteTableInfo AS 
(
	SELECT 
		COUNT(1) AS ct
		,SUM(length(t::text)) AS TextLength  
		,'public.tbl_testjson'::regclass AS TableName  
	FROM public.tbl_testjson AS t  
)
,cteRowSize AS 
(
   SELECT ARRAY [pg_relation_size(TableName)
               , pg_relation_size(TableName, 'vm')
               , pg_relation_size(TableName, 'fsm')
               , pg_table_size(TableName)
               , pg_indexes_size(TableName)
               , pg_total_relation_size(TableName)
               , TextLength
             ] AS val
        , ARRAY ['Total Relation Size'
               , 'Visibility Map'
               , 'Free Space Map'
               , 'Table Included Toast Size'
               , 'Indexes Size'
               , 'Total Toast and Indexes Size'
               , 'Live Row Byte Size'
             ] AS Name
   FROM cteTableInfo
)
SELECT 
	unnest(name) AS Description
	,unnest(val) AS Bytes
	,pg_size_pretty(unnest(val)) AS BytesPretty
	,unnest(val) / ct AS bytes_per_row
FROM cteTableInfo, cteRowSize

UNION ALL SELECT '------------------------------', NULL, NULL, NULL
UNION ALL SELECT 'TotalRows', ct, NULL, NULL FROM cteTableInfo
UNION ALL SELECT 'LiveTuples', pg_stat_get_live_tuples(TableName), NULL, NULL FROM cteTableInfo
UNION ALL SELECT 'DeadTuples', pg_stat_get_dead_tuples(TableName), NULL, NULL FROM cteTableInfo;</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/03/postgresql-how-to-measure-the-size-of-a-table-row-and-data-page/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: The Awesome Table Fillfactor to speedup UPDATE and SELECT statement</title>
		<link>https://www.dbrnd.com/2016/03/postgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement/</link>
					<comments>https://www.dbrnd.com/2016/03/postgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 28 Mar 2016 20:34:41 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Fillfactor]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2188</guid>

					<description><![CDATA[This is one of the most important articles for all PostgreSQL Database Professionals because it relates to PostgreSQL database optimization &#160; &#160; &#160; First, You guys have to know what is MVCC and how it manages the different row versions. What is Fillfactor and how it impacts the performance? The Fillfactor is a table storage [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement%2F&amp;linkname=PostgreSQL%3A%20The%20Awesome%20Table%20Fillfactor%20to%20speedup%20UPDATE%20and%20SELECT%20statement" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement%2F&amp;linkname=PostgreSQL%3A%20The%20Awesome%20Table%20Fillfactor%20to%20speedup%20UPDATE%20and%20SELECT%20statement" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement%2F&amp;linkname=PostgreSQL%3A%20The%20Awesome%20Table%20Fillfactor%20to%20speedup%20UPDATE%20and%20SELECT%20statement" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement%2F&amp;linkname=PostgreSQL%3A%20The%20Awesome%20Table%20Fillfactor%20to%20speedup%20UPDATE%20and%20SELECT%20statement" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement%2F&amp;linkname=PostgreSQL%3A%20The%20Awesome%20Table%20Fillfactor%20to%20speedup%20UPDATE%20and%20SELECT%20statement" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement%2F&amp;linkname=PostgreSQL%3A%20The%20Awesome%20Table%20Fillfactor%20to%20speedup%20UPDATE%20and%20SELECT%20statement" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement%2F&#038;title=PostgreSQL%3A%20The%20Awesome%20Table%20Fillfactor%20to%20speedup%20UPDATE%20and%20SELECT%20statement" data-a2a-url="https://www.dbrnd.com/2016/03/postgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement/" data-a2a-title="PostgreSQL: The Awesome Table Fillfactor to speedup UPDATE and SELECT statement"></a></p><p><a href="https://www.dbrnd.com/wp-content/uploads/2016/03/PostgreSQLFillFactor.jpg" rel="attachment wp-att-2212"><img fetchpriority="high" decoding="async" class="alignleft wp-image-2212 size-medium" title="PostgreSQL Table FillFactor" src="https://www.dbrnd.com/wp-content/uploads/2016/03/PostgreSQLFillFactor-300x254.jpg" alt="PostgreSQL Table FillFactor" width="300" height="254" srcset="https://www.dbrnd.com/wp-content/uploads/2016/03/PostgreSQLFillFactor-300x254.jpg 300w, https://www.dbrnd.com/wp-content/uploads/2016/03/PostgreSQLFillFactor-1024x866.jpg 1024w, https://www.dbrnd.com/wp-content/uploads/2016/03/PostgreSQLFillFactor-750x634.jpg 750w, https://www.dbrnd.com/wp-content/uploads/2016/03/PostgreSQLFillFactor-150x127.jpg 150w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p><em>This is one of the most important articles for all PostgreSQL Database Professionals because it relates to PostgreSQL database optimization </em></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="https://www.dbrnd.com/2015/05/what-is-mvcc-multi-version-concurrency-control/" target="_blank"><strong>First, You guys have to know what is MVCC and how it manages the different row versions. </strong></a></p>
<p><strong>What is Fillfactor and how it impacts the performance?</strong></p>
<blockquote><p>The Fillfactor is a table storage parameter and for the performance aspect this is the most important parameter.</p></blockquote>
<blockquote><p>The Fillfactor for a table is a percentage between 10 and 100. 100 is the default for a complete packing.</p></blockquote>
<blockquote><p>Because of this default 100 value, when one UPDATE is performed, the old tuple is marked as deleted and a new tuple is inserted into another page.<br />
There is no extra space to write a new tuple on the same page because default 100 means write data in page till its full.</p></blockquote>
<blockquote><p>Now, next impact of this default 100 is, related indexes of newly updated records are modified because it has to point to the new page location.</p></blockquote>
<blockquote><p>If you notice here, for one UPDATE actually there are three operations, first mark deleted tuples, write new tuples in the new pages, and index modifications.</p></blockquote>
<blockquote><p>This is not just about the UPDATE but actually the performance of SELECT query also will degrade because of the internal fragmentation.</p></blockquote>
<p><strong>How can we improve the performance?</strong>6</p>
<blockquote><p>The default Fillfactor is 100 and it is better, but not in all situations.<br />
When your table has frequent updates, this is not a better solution because it requires more CPU and IO for different data page operations which actually degrade the performance.</p></blockquote>
<blockquote><p>The solution is to first measure the size of the tuple and if tuple size is not that much bigger, we can reduce the value of default Fillfactor.</p></blockquote>
<blockquote><p><a href="https://www.dbrnd.com/2016/03/postgresql-how-to-measure-the-size-of-a-table-row-and-data-page/" target="_blank"><strong>How to measure the size of the tuple in PostgreSQL?</strong></a></p></blockquote>
<blockquote><p><a href="https://www.dbrnd.com/2016/03/postgresql-alter-table-to-change-fillfactor-value/" target="_blank"><strong>How to change the current value of Table Fillfactor in PostgreSQL?</strong></a></p></blockquote>
<blockquote><p>When we reduce the default value of Fillfactor, each page has some free space and new tuple which is generated by UPDATE can be stored on the same page.</p>
<p>Now, index page does not require any modification because new tuple is on the same page.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/03/postgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
