<?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>ANALYZE &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/analyze/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>Mon, 26 Mar 2018 07:50:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>PostgreSQL: Script to check the status of AutoVacuum for all Tables</title>
		<link>https://www.dbrnd.com/2018/03/postgresql-script-to-check-the-status-of-autovacuum-for-all-tables/</link>
					<comments>https://www.dbrnd.com/2018/03/postgresql-script-to-check-the-status-of-autovacuum-for-all-tables/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 30 Mar 2018 16:16:01 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[PostgreSQL DBA Script]]></category>
		<category><![CDATA[ANALYZE]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[AUTO VACUUM]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></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 Monitoring]]></category>
		<category><![CDATA[PostgreSQL Performance Tuning]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[VACUUM]]></category>
		<category><![CDATA[VACUUM FULL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7290</guid>

					<description><![CDATA[In this post, I am sharing a script for checking the status of AutoVacuum for all the PostgreSQL Tables. If you don&#8217;t know about the MVCC architecture, you must visit the below article. Because of MVCC, we have to work on dead tuples which are generated by transactions in PostgreSQL. What is Multi Version Concurrency [&#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%2F2018%2F03%2Fpostgresql-script-to-check-the-status-of-autovacuum-for-all-tables%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20the%20status%20of%20AutoVacuum%20for%20all%20Tables" 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%2F2018%2F03%2Fpostgresql-script-to-check-the-status-of-autovacuum-for-all-tables%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20the%20status%20of%20AutoVacuum%20for%20all%20Tables" 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%2F2018%2F03%2Fpostgresql-script-to-check-the-status-of-autovacuum-for-all-tables%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20the%20status%20of%20AutoVacuum%20for%20all%20Tables" 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%2F2018%2F03%2Fpostgresql-script-to-check-the-status-of-autovacuum-for-all-tables%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20the%20status%20of%20AutoVacuum%20for%20all%20Tables" 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%2F2018%2F03%2Fpostgresql-script-to-check-the-status-of-autovacuum-for-all-tables%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20the%20status%20of%20AutoVacuum%20for%20all%20Tables" 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%2F2018%2F03%2Fpostgresql-script-to-check-the-status-of-autovacuum-for-all-tables%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20the%20status%20of%20AutoVacuum%20for%20all%20Tables" 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%2F2018%2F03%2Fpostgresql-script-to-check-the-status-of-autovacuum-for-all-tables%2F&#038;title=PostgreSQL%3A%20Script%20to%20check%20the%20status%20of%20AutoVacuum%20for%20all%20Tables" data-a2a-url="https://www.dbrnd.com/2018/03/postgresql-script-to-check-the-status-of-autovacuum-for-all-tables/" data-a2a-title="PostgreSQL: Script to check the status of AutoVacuum for all Tables"></a></p><p>In this post, I am sharing a script for checking the status of AutoVacuum for all the PostgreSQL Tables. </p>
<p>If you don&#8217;t know about the MVCC architecture, you must visit the below article. Because of MVCC, we have to work on dead tuples which are generated by transactions in PostgreSQL. </p>
<blockquote class="wp-embedded-content" data-secret="JhjxG59FPW"><p><a href="https://www.dbrnd.com/2015/05/what-is-mvcc-multi-version-concurrency-control/">What is Multi Version Concurrency Control (MVCC)</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/05/what-is-mvcc-multi-version-concurrency-control/embed/#?secret=JhjxG59FPW" data-secret="JhjxG59FPW" width="600" height="338" title="&#8220;What is Multi Version Concurrency Control (MVCC)&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>You can configure auto-vacuum on tables, but periodically you should check the status of it. Use below script for checking the status of Autovacuum. </p>
<blockquote class="wp-embedded-content" data-secret="HyZBhFsEqV"><p><a href="https://www.dbrnd.com/2015/11/postgresql-short-note-on-vacuum-vacuum-full-and-analyze/">PostgreSQL: Short note on VACUUM, VACUUM FULL and ANALYZE</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/11/postgresql-short-note-on-vacuum-vacuum-full-and-analyze/embed/#?secret=HyZBhFsEqV" data-secret="HyZBhFsEqV" width="600" height="338" title="&#8220;PostgreSQL: Short note on VACUUM, VACUUM FULL and ANALYZE&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="gCeWbfwdsz"><p><a href="https://www.dbrnd.com/2016/08/postgresql-force-autovacuum-for-running-aggressive-improve-performance-of-autovacuum-frequent-run/">PostgreSQL: Force Autovacuum for running Aggressive</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/08/postgresql-force-autovacuum-for-running-aggressive-improve-performance-of-autovacuum-frequent-run/embed/#?secret=gCeWbfwdsz" data-secret="gCeWbfwdsz" width="600" height="338" title="&#8220;PostgreSQL: Force Autovacuum for running Aggressive&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<pre class="crayon-plain-tag">SELECT 
    schemaname
    ,relname
    ,n_live_tup
    ,n_dead_tup
    ,last_autovacuum
FROM pg_stat_all_tables
ORDER BY n_dead_tup
    /(n_live_tup
      * current_setting('autovacuum_vacuum_scale_factor')::float8
      + current_setting('autovacuum_vacuum_threshold')::float8)
     DESC</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/03/postgresql-script-to-check-the-status-of-autovacuum-for-all-tables/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Greenplum: gp_bloat_diag to get the list of pending VACUUM of Tables</title>
		<link>https://www.dbrnd.com/2018/02/greenplum-gp_bloat_diag-to-get-the-list-of-pending-vacuum-of-tables-remove-fragmentation-improve-performance/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 05 Feb 2018 16:16:23 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[ACCESS EXCLUSIVE LOCK]]></category>
		<category><![CDATA[ANALYZE]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[gp_bloat_diag]]></category>
		<category><![CDATA[gp_toolkit]]></category>
		<category><![CDATA[Greenplum Administrator]]></category>
		<category><![CDATA[Greenplum Error]]></category>
		<category><![CDATA[Greenplum Monitoring]]></category>
		<category><![CDATA[Greenplum Performance Tuning]]></category>
		<category><![CDATA[Greenplum Programming]]></category>
		<category><![CDATA[Greenplum Query]]></category>
		<category><![CDATA[Greenplum Tips and Tricks]]></category>
		<category><![CDATA[PostgreSQL 8.2]]></category>
		<category><![CDATA[VACUUM]]></category>
		<category><![CDATA[VACUUM FULL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4425</guid>

					<description><![CDATA[In this post, I am sharing an important gp_toolkit view to finding a list of a table on which VACUUM is required to be run in Greenplum Database Server. Greenplum is based on PostgreSQL 8.2 and MVCC architecture. It generates dead tuples at every UPDATE and DELETE which is a fragmentation in the form 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%2F2018%2F02%2Fgreenplum-gp_bloat_diag-to-get-the-list-of-pending-vacuum-of-tables-remove-fragmentation-improve-performance%2F&amp;linkname=Greenplum%3A%20gp_bloat_diag%20to%20get%20the%20list%20of%20pending%20VACUUM%20of%20Tables" 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%2F2018%2F02%2Fgreenplum-gp_bloat_diag-to-get-the-list-of-pending-vacuum-of-tables-remove-fragmentation-improve-performance%2F&amp;linkname=Greenplum%3A%20gp_bloat_diag%20to%20get%20the%20list%20of%20pending%20VACUUM%20of%20Tables" 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%2F2018%2F02%2Fgreenplum-gp_bloat_diag-to-get-the-list-of-pending-vacuum-of-tables-remove-fragmentation-improve-performance%2F&amp;linkname=Greenplum%3A%20gp_bloat_diag%20to%20get%20the%20list%20of%20pending%20VACUUM%20of%20Tables" 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%2F2018%2F02%2Fgreenplum-gp_bloat_diag-to-get-the-list-of-pending-vacuum-of-tables-remove-fragmentation-improve-performance%2F&amp;linkname=Greenplum%3A%20gp_bloat_diag%20to%20get%20the%20list%20of%20pending%20VACUUM%20of%20Tables" 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%2F2018%2F02%2Fgreenplum-gp_bloat_diag-to-get-the-list-of-pending-vacuum-of-tables-remove-fragmentation-improve-performance%2F&amp;linkname=Greenplum%3A%20gp_bloat_diag%20to%20get%20the%20list%20of%20pending%20VACUUM%20of%20Tables" 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%2F2018%2F02%2Fgreenplum-gp_bloat_diag-to-get-the-list-of-pending-vacuum-of-tables-remove-fragmentation-improve-performance%2F&amp;linkname=Greenplum%3A%20gp_bloat_diag%20to%20get%20the%20list%20of%20pending%20VACUUM%20of%20Tables" 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%2F2018%2F02%2Fgreenplum-gp_bloat_diag-to-get-the-list-of-pending-vacuum-of-tables-remove-fragmentation-improve-performance%2F&#038;title=Greenplum%3A%20gp_bloat_diag%20to%20get%20the%20list%20of%20pending%20VACUUM%20of%20Tables" data-a2a-url="https://www.dbrnd.com/2018/02/greenplum-gp_bloat_diag-to-get-the-list-of-pending-vacuum-of-tables-remove-fragmentation-improve-performance/" data-a2a-title="Greenplum: gp_bloat_diag to get the list of pending VACUUM of Tables"></a></p><p>In this post, I am sharing an important gp_toolkit view to finding a list of a table on which VACUUM is required to be run in Greenplum Database Server. </p>
<blockquote><p>Greenplum is based on PostgreSQL 8.2 and MVCC architecture. It generates dead tuples at every UPDATE and DELETE which is a fragmentation in the form of dead tuples which we can remove by executing a VACUUM/VACUUM FULL command. </p></blockquote>
<blockquote class="wp-embedded-content" data-secret="MOZC5oUpBb"><p><a href="https://www.dbrnd.com/2015/05/what-is-mvcc-multi-version-concurrency-control/">What is Multi Version Concurrency Control (MVCC)</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/05/what-is-mvcc-multi-version-concurrency-control/embed/#?secret=MOZC5oUpBb" data-secret="MOZC5oUpBb" width="600" height="338" title="&#8220;What is Multi Version Concurrency Control (MVCC)&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote><p>A gp_toolkit is an administrative schema of Greenplum Database server. It provides the list of various views to monitor the Greenplum server.</p></blockquote>
<p>A gp_bloat_diag is one of the views of a gp_toolkit schema which gives us a list of tables which may require a VACUUM to be run. </p>
<p>It returns the actual number of pages and the expected number of pages. If a count of an actual number of pages is greater than expected number of pages, that table requires VACUUM. </p>
<p>If you want to re-use the wasted space of table, execute VACUUM FULL on it which requires ACCESS EXCLUSIVE LOCK on a table because it re-writes all the data pages from the scratch.</p>
<p>If you execute only VACUUM, you cannot reclaims the free space of table.<br />
You must execute ANALYZE after the execution of VACUUM/VACUUM FULL for updating database statistics. </p>
<p><strong>Below is a query:</strong></p>
<pre class="crayon-plain-tag">SELECT * FROM gp_toolkit.gp_bloat_diag;</pre> </p>
<p>After executing the above query, you can get the list of six columns. The important columns are &#8220;bdirelpages&#8221; and &#8220;bdiexppages&#8221; means real pages and expected pages. </p>
<p>If you find your table in the result set, your table requires VACUUM/VACUUM FULL. </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Greenplum: gp_stats_missing to get the list of pending ANALYZE of Tables</title>
		<link>https://www.dbrnd.com/2018/02/greenplum-gp_stats_missing-to-get-the-list-of-pending-analyze-of-tables-gp_toolkit-gp_stats_missing/</link>
					<comments>https://www.dbrnd.com/2018/02/greenplum-gp_stats_missing-to-get-the-list-of-pending-analyze-of-tables-gp_toolkit-gp_stats_missing/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 04 Feb 2018 16:16:11 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[ANALYZE]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[Database Statistics]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[gp_stats_missing]]></category>
		<category><![CDATA[gp_toolkit]]></category>
		<category><![CDATA[Greenplum Administrator]]></category>
		<category><![CDATA[Greenplum Error]]></category>
		<category><![CDATA[Greenplum Monitoring]]></category>
		<category><![CDATA[Greenplum Performance Tuning]]></category>
		<category><![CDATA[Greenplum Programming]]></category>
		<category><![CDATA[Greenplum Query]]></category>
		<category><![CDATA[Greenplum Tips and Tricks]]></category>
		<category><![CDATA[PostgreSQL 8.2]]></category>
		<category><![CDATA[smisize]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4424</guid>

					<description><![CDATA[In this post, I am sharing an important gp_toolkit view to finding a list of a table on which ANALYZE is required to be run in Greenplum Database Server. An ANALYZE command is used to update the object or database statistics information. The query planner always uses the statistics for building the execution plans. A [&#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%2F2018%2F02%2Fgreenplum-gp_stats_missing-to-get-the-list-of-pending-analyze-of-tables-gp_toolkit-gp_stats_missing%2F&amp;linkname=Greenplum%3A%20gp_stats_missing%20to%20get%20the%20list%20of%20pending%20ANALYZE%20of%20Tables" 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%2F2018%2F02%2Fgreenplum-gp_stats_missing-to-get-the-list-of-pending-analyze-of-tables-gp_toolkit-gp_stats_missing%2F&amp;linkname=Greenplum%3A%20gp_stats_missing%20to%20get%20the%20list%20of%20pending%20ANALYZE%20of%20Tables" 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%2F2018%2F02%2Fgreenplum-gp_stats_missing-to-get-the-list-of-pending-analyze-of-tables-gp_toolkit-gp_stats_missing%2F&amp;linkname=Greenplum%3A%20gp_stats_missing%20to%20get%20the%20list%20of%20pending%20ANALYZE%20of%20Tables" 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%2F2018%2F02%2Fgreenplum-gp_stats_missing-to-get-the-list-of-pending-analyze-of-tables-gp_toolkit-gp_stats_missing%2F&amp;linkname=Greenplum%3A%20gp_stats_missing%20to%20get%20the%20list%20of%20pending%20ANALYZE%20of%20Tables" 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%2F2018%2F02%2Fgreenplum-gp_stats_missing-to-get-the-list-of-pending-analyze-of-tables-gp_toolkit-gp_stats_missing%2F&amp;linkname=Greenplum%3A%20gp_stats_missing%20to%20get%20the%20list%20of%20pending%20ANALYZE%20of%20Tables" 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%2F2018%2F02%2Fgreenplum-gp_stats_missing-to-get-the-list-of-pending-analyze-of-tables-gp_toolkit-gp_stats_missing%2F&amp;linkname=Greenplum%3A%20gp_stats_missing%20to%20get%20the%20list%20of%20pending%20ANALYZE%20of%20Tables" 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%2F2018%2F02%2Fgreenplum-gp_stats_missing-to-get-the-list-of-pending-analyze-of-tables-gp_toolkit-gp_stats_missing%2F&#038;title=Greenplum%3A%20gp_stats_missing%20to%20get%20the%20list%20of%20pending%20ANALYZE%20of%20Tables" data-a2a-url="https://www.dbrnd.com/2018/02/greenplum-gp_stats_missing-to-get-the-list-of-pending-analyze-of-tables-gp_toolkit-gp_stats_missing/" data-a2a-title="Greenplum: gp_stats_missing to get the list of pending ANALYZE of Tables"></a></p><p>In this post, I am sharing an important gp_toolkit view to finding a list of a table on which ANALYZE is required to be run in Greenplum Database Server. </p>
<blockquote><p>An ANALYZE command is used to update the object or database statistics information. The query planner always uses the statistics for building the execution plans. </p></blockquote>
<blockquote><p>A gp_toolkit is an administrative schema of Greenplum Database server. It provides the list of various views to monitor the Greenplum server.</p></blockquote>
<blockquote><p>A gp_stats_missing is one of the views of a gp_toolkit schema which gives us a list of tables which may require an ANALYZE to be run. </p></blockquote>
<p><strong>Below is a query:</strong></p>
<pre class="crayon-plain-tag">SELECT * FROM gp_toolkit.gp_stats_missing;</pre> </p>
<p>After executing the above query, you can get the list of five columns. A column &#8220;smisize&#8221; is an important column to check the status of table statistics. </p>
<p>If it contains value &#8216;f&#8217;, a table does not have row count and row sizing statistics recorded in the system catalog, which indicates that the table needs to be analyzed. </p>
<p>The meaning of other columns like &#8220;simcols&#8221;: number of columns in the table, &#8220;simrecs&#8221;: number of rows in the table.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/02/greenplum-gp_stats_missing-to-get-the-list-of-pending-analyze-of-tables-gp_toolkit-gp_stats_missing/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Greenplum: When the last VACUUM or ANALYZE executed on Tables?</title>
		<link>https://www.dbrnd.com/2017/06/greenplum-when-the-last-vacuum-or-analyze-executed-on-tables-pg_stat_last_operation/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 21 Jun 2017 16:16:00 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Greenplum DBA Script]]></category>
		<category><![CDATA[ANALYZE]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Greenplum Administrator]]></category>
		<category><![CDATA[Greenplum Error]]></category>
		<category><![CDATA[Greenplum Monitoring]]></category>
		<category><![CDATA[Greenplum Performance Tuning]]></category>
		<category><![CDATA[Greenplum Programming]]></category>
		<category><![CDATA[Greenplum Query]]></category>
		<category><![CDATA[Greenplum Tips and Tricks]]></category>
		<category><![CDATA[pg_stat_last_operation]]></category>
		<category><![CDATA[PostgreSQL 8.2]]></category>
		<category><![CDATA[VACUUM]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5435</guid>

					<description><![CDATA[In this post, I am sharing a script to find a list of tables with the information like the last action_date of VACUUM and ANALYZE in Greenplum. Before executing VACUUM or ANALYZE on tables, we should check the last execution time of it. If it recently executed, we should skip those tables for VACUUM or [&#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%2F06%2Fgreenplum-when-the-last-vacuum-or-analyze-executed-on-tables-pg_stat_last_operation%2F&amp;linkname=Greenplum%3A%20When%20the%20last%20VACUUM%20or%20ANALYZE%20executed%20on%20Tables%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%2F2017%2F06%2Fgreenplum-when-the-last-vacuum-or-analyze-executed-on-tables-pg_stat_last_operation%2F&amp;linkname=Greenplum%3A%20When%20the%20last%20VACUUM%20or%20ANALYZE%20executed%20on%20Tables%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%2F2017%2F06%2Fgreenplum-when-the-last-vacuum-or-analyze-executed-on-tables-pg_stat_last_operation%2F&amp;linkname=Greenplum%3A%20When%20the%20last%20VACUUM%20or%20ANALYZE%20executed%20on%20Tables%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%2F2017%2F06%2Fgreenplum-when-the-last-vacuum-or-analyze-executed-on-tables-pg_stat_last_operation%2F&amp;linkname=Greenplum%3A%20When%20the%20last%20VACUUM%20or%20ANALYZE%20executed%20on%20Tables%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%2F2017%2F06%2Fgreenplum-when-the-last-vacuum-or-analyze-executed-on-tables-pg_stat_last_operation%2F&amp;linkname=Greenplum%3A%20When%20the%20last%20VACUUM%20or%20ANALYZE%20executed%20on%20Tables%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%2F2017%2F06%2Fgreenplum-when-the-last-vacuum-or-analyze-executed-on-tables-pg_stat_last_operation%2F&amp;linkname=Greenplum%3A%20When%20the%20last%20VACUUM%20or%20ANALYZE%20executed%20on%20Tables%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%2F2017%2F06%2Fgreenplum-when-the-last-vacuum-or-analyze-executed-on-tables-pg_stat_last_operation%2F&#038;title=Greenplum%3A%20When%20the%20last%20VACUUM%20or%20ANALYZE%20executed%20on%20Tables%3F" data-a2a-url="https://www.dbrnd.com/2017/06/greenplum-when-the-last-vacuum-or-analyze-executed-on-tables-pg_stat_last_operation/" data-a2a-title="Greenplum: When the last VACUUM or ANALYZE executed on Tables?"></a></p><p>In this post, I am sharing a script to find a list of tables with the information like the last action_date of VACUUM and ANALYZE in Greenplum.</p>
<p>Before executing VACUUM or ANALYZE on tables, we should check the last execution time of it. If it recently executed, we should skip those tables for VACUUM or ANALYZE.<br />
In below script, I am finding this information from pg_stat_last_operation.</p>
<pre class="crayon-plain-tag">select
       pn.nspname
       ,pc.relname
       ,pslo.staactionname
       ,pslo.stasubtype
       ,pslo.statime as action_date
from pg_stat_last_operation pslo
right outer join pg_class pc
                on pc.oid = pslo.objid and pslo.staactionname in ('VACUUM','ANALYZE')
join pg_namespace pn
                on pn.oid = pc.relnamespace
where pc.relkind IN ('r','s')
AND pc.relstorage IN ('h', 'a', 'c');</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Important Statistics Table, Used by the Query Planner</title>
		<link>https://www.dbrnd.com/2016/09/postgresql-important-statistics-table-used-by-the-query-planner-pg_class-pg_stats-vacuum-analyze/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 04 Sep 2016 12:55:17 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[ANALYZE]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[pg_class]]></category>
		<category><![CDATA[pg_stats]]></category>
		<category><![CDATA[planner]]></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[query optimzer]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[VACUUM]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3585</guid>

					<description><![CDATA[In any RDBMS system, Different type of Statistics is very important for Query Optimizer and Planner to choose and generate the best Query Execution Plan. PostgreSQL Database Server also managing different types of Statistic which are used by the Query Optimizer to generate the best Query Execution Plan. Statistical data should be updated, Why? For [&#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%2F09%2Fpostgresql-important-statistics-table-used-by-the-query-planner-pg_class-pg_stats-vacuum-analyze%2F&amp;linkname=PostgreSQL%3A%20Important%20Statistics%20Table%2C%20Used%20by%20the%20Query%20Planner" 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%2F09%2Fpostgresql-important-statistics-table-used-by-the-query-planner-pg_class-pg_stats-vacuum-analyze%2F&amp;linkname=PostgreSQL%3A%20Important%20Statistics%20Table%2C%20Used%20by%20the%20Query%20Planner" 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%2F09%2Fpostgresql-important-statistics-table-used-by-the-query-planner-pg_class-pg_stats-vacuum-analyze%2F&amp;linkname=PostgreSQL%3A%20Important%20Statistics%20Table%2C%20Used%20by%20the%20Query%20Planner" 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%2F09%2Fpostgresql-important-statistics-table-used-by-the-query-planner-pg_class-pg_stats-vacuum-analyze%2F&amp;linkname=PostgreSQL%3A%20Important%20Statistics%20Table%2C%20Used%20by%20the%20Query%20Planner" 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%2F09%2Fpostgresql-important-statistics-table-used-by-the-query-planner-pg_class-pg_stats-vacuum-analyze%2F&amp;linkname=PostgreSQL%3A%20Important%20Statistics%20Table%2C%20Used%20by%20the%20Query%20Planner" 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%2F09%2Fpostgresql-important-statistics-table-used-by-the-query-planner-pg_class-pg_stats-vacuum-analyze%2F&amp;linkname=PostgreSQL%3A%20Important%20Statistics%20Table%2C%20Used%20by%20the%20Query%20Planner" 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%2F09%2Fpostgresql-important-statistics-table-used-by-the-query-planner-pg_class-pg_stats-vacuum-analyze%2F&#038;title=PostgreSQL%3A%20Important%20Statistics%20Table%2C%20Used%20by%20the%20Query%20Planner" data-a2a-url="https://www.dbrnd.com/2016/09/postgresql-important-statistics-table-used-by-the-query-planner-pg_class-pg_stats-vacuum-analyze/" data-a2a-title="PostgreSQL: Important Statistics Table, Used by the Query Planner"></a></p><p>In any RDBMS system, Different type of Statistics is very important for Query Optimizer and Planner to choose and generate the best Query Execution Plan. </p>
<blockquote><p>PostgreSQL Database Server also managing different types of Statistic which are used by the Query Optimizer to generate the best Query Execution Plan. </p></blockquote>
<p><strong>Statistical data should be updated, Why?</strong><br />
For Example, </p>
<blockquote><p>We have one table with 100000 rows, but table statistic data are not updated and showing only 1000 tuples information. </p></blockquote>
<blockquote><p>Query optimizer always looks into Statistic tables, It never looks into direct table files. </p></blockquote>
<blockquote><p>So in this situation, It generates the wrong Query Execution Plan because It has only 1000 rows information, but actually there are 100000 rows. </p></blockquote>
<p>PostgreSQL Database Server is mainly using two Statistical Table. </p>
<pre class="crayon-plain-tag">SELECT *FROM pg_class;
SELECT *FROM pg_stats;</pre> </p>
<blockquote><p>You can also query these tables and can find information about Tables, Indexes, Pages and others. </p></blockquote>
<blockquote><p>When you look into table pg_class, you can find &#8220;reltuples&#8221; column. You can compare this column value with your actual table record count. </p></blockquote>
<blockquote><p>If you find any mismatch, for that table statistic information is not updated. </p></blockquote>
<p><strong>Execute Analyze command:</strong></p>
<blockquote><p>When you find that Statistical information is not updated, you can execute the ANALYZE command on the Database or Table.<br />
After executing the ANALYZE command, It updates all require statistics.
</p></blockquote>
<blockquote class="wp-embedded-content" data-secret="es4VwJnXrq"><p><a href="https://www.dbrnd.com/2015/11/postgresql-short-note-on-vacuum-vacuum-full-and-analyze/">PostgreSQL: Short note on VACUUM, VACUUM FULL and ANALYZE</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/11/postgresql-short-note-on-vacuum-vacuum-full-and-analyze/embed/#?secret=es4VwJnXrq" data-secret="es4VwJnXrq" width="600" height="338" title="&#8220;PostgreSQL: Short note on VACUUM, VACUUM FULL and ANALYZE&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Short note on VACUUM, VACUUM FULL and ANALYZE</title>
		<link>https://www.dbrnd.com/2015/11/postgresql-short-note-on-vacuum-vacuum-full-and-analyze/</link>
					<comments>https://www.dbrnd.com/2015/11/postgresql-short-note-on-vacuum-vacuum-full-and-analyze/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 21 Nov 2015 17:47:18 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[ANALYZE]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></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[VACUUM]]></category>
		<category><![CDATA[VACUUM FULL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=1081</guid>

					<description><![CDATA[VACUUM, VACUUM FULL and ANALYZE: These are the maintenance related commands of PostgreSQL which requires frequent execution because PostgreSQL based on MVCC architecture where every UPDATE and DELETE generates dead rows or dead tuples as an internal fragmentation. If you don&#8217;t about the MVCC, you must visit the below article. What is MVCC? VACUUM: VACUUM [&#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%2F2015%2F11%2Fpostgresql-short-note-on-vacuum-vacuum-full-and-analyze%2F&amp;linkname=PostgreSQL%3A%20Short%20note%20on%20VACUUM%2C%20VACUUM%20FULL%20and%20ANALYZE" 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%2F2015%2F11%2Fpostgresql-short-note-on-vacuum-vacuum-full-and-analyze%2F&amp;linkname=PostgreSQL%3A%20Short%20note%20on%20VACUUM%2C%20VACUUM%20FULL%20and%20ANALYZE" 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%2F2015%2F11%2Fpostgresql-short-note-on-vacuum-vacuum-full-and-analyze%2F&amp;linkname=PostgreSQL%3A%20Short%20note%20on%20VACUUM%2C%20VACUUM%20FULL%20and%20ANALYZE" 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%2F2015%2F11%2Fpostgresql-short-note-on-vacuum-vacuum-full-and-analyze%2F&amp;linkname=PostgreSQL%3A%20Short%20note%20on%20VACUUM%2C%20VACUUM%20FULL%20and%20ANALYZE" 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%2F2015%2F11%2Fpostgresql-short-note-on-vacuum-vacuum-full-and-analyze%2F&amp;linkname=PostgreSQL%3A%20Short%20note%20on%20VACUUM%2C%20VACUUM%20FULL%20and%20ANALYZE" 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%2F2015%2F11%2Fpostgresql-short-note-on-vacuum-vacuum-full-and-analyze%2F&amp;linkname=PostgreSQL%3A%20Short%20note%20on%20VACUUM%2C%20VACUUM%20FULL%20and%20ANALYZE" 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%2F2015%2F11%2Fpostgresql-short-note-on-vacuum-vacuum-full-and-analyze%2F&#038;title=PostgreSQL%3A%20Short%20note%20on%20VACUUM%2C%20VACUUM%20FULL%20and%20ANALYZE" data-a2a-url="https://www.dbrnd.com/2015/11/postgresql-short-note-on-vacuum-vacuum-full-and-analyze/" data-a2a-title="PostgreSQL: Short note on VACUUM, VACUUM FULL and ANALYZE"></a></p><p><strong>VACUUM, VACUUM FULL and ANALYZE:</strong> These are the maintenance related commands of PostgreSQL which requires frequent execution because PostgreSQL based on MVCC architecture where every UPDATE and DELETE generates dead rows or dead tuples as an internal fragmentation. </p>
<p>If you don&#8217;t about the MVCC, you must visit the below article.<br />
<a href="https://www.dbrnd.com/2015/05/what-is-mvcc-multi-version-concurrency-control/" target="_blank"><strong>What is MVCC?</strong></a></p>
<p><strong>VACUUM:</strong> </p>
<blockquote><p>VACUUM reclaims storage occupied by dead tuples.<br />
In the MCVV architecture tuples that deleted which is not physically remove. It presents in a disk until a VACUUM is done.</p>
<p>If you are executing frequent UPDATE/DELETE on your table, you must find the fragmentation and must execute VACUUM on it.<br />
VACUUM does not require an exclusive lock on the table.<br />
<strong>Syntax:</strong></p>
<pre class="crayon-plain-tag">VACUUM Table_Name;</pre> </p>
</blockquote>
<p><strong>VACUUM FULL:</strong></p>
<blockquote><p>
Whatever space reclaims by VACUUM that space might require to use for next storage.<br />
VACUUM FULL rewrites the entire table with data and releases all fragmented space of an old table.</p>
<p>We should avoid the VACUUM FULL because it shrinks the whole table and writes everything into the new disk block which requires more resources and disk space to complete this operation.</p>
<p>If you find a huge number of dead rows, you should execute VACUUM FULL on that table.<br />
VACUUM FULL requires an exclusive lock on the table and also require a free disk space as same as your table size.<br />
<strong>Syntax:</strong></p><pre class="crayon-plain-tag">VACUUM FULL Table_Name;</pre><p> </p>
</blockquote>
<p><strong>ANALYZE:</strong></p>
<blockquote><p>
After execution of VACUUM or VACUUM FULL, you must execute this command to update the statistics.<br />
ANALYZE updates all require statistics and stores the results in the pg_statistic system catalog. </p>
<p>The Query Planner uses this database statistics information to prepare an efficient query execution plan.<br />
You can also execute VACUUM ANALYZE, which executes the first VACUUM and then executes ANALYZE.<br />
<strong>Syntax:</strong></p>
<pre class="crayon-plain-tag">ANALYZE Table_Name;
VACUUM ANALYZE Table_Name;</pre> </p>
</blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2015/11/postgresql-short-note-on-vacuum-vacuum-full-and-analyze/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
