<?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>gp_toolkit &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/gp_toolkit/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>Tue, 16 Jan 2018 11:24:40 +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>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 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: Script to find running queries or statements which are Waiting in Resource Queues</title>
		<link>https://www.dbrnd.com/2017/11/greenplum-script-to-find-running-queries-or-statements-which-are-waiting-in-resource-queues/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 30 Nov 2017 16:16:09 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Greenplum 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[gp_resqueue_status]]></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[Resource Queue]]></category>
		<category><![CDATA[Workload management]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6120</guid>

					<description><![CDATA[In this post, I am sharing a script to check the list of running queries or statements which are waiting in the Resource Queues of Greenplum. The Workload management of Greenplum means &#8211; Set priorities of database user&#8217;s queries using Resource Queues. If you create RQ with the limit of 10 concurrent queries and user [&#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%2F11%2Fgreenplum-script-to-find-running-queries-or-statements-which-are-waiting-in-resource-queues%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20running%20queries%20or%20statements%20which%20are%20Waiting%20in%20Resource%20Queues" 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%2F11%2Fgreenplum-script-to-find-running-queries-or-statements-which-are-waiting-in-resource-queues%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20running%20queries%20or%20statements%20which%20are%20Waiting%20in%20Resource%20Queues" 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%2F11%2Fgreenplum-script-to-find-running-queries-or-statements-which-are-waiting-in-resource-queues%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20running%20queries%20or%20statements%20which%20are%20Waiting%20in%20Resource%20Queues" 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%2F11%2Fgreenplum-script-to-find-running-queries-or-statements-which-are-waiting-in-resource-queues%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20running%20queries%20or%20statements%20which%20are%20Waiting%20in%20Resource%20Queues" 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%2F11%2Fgreenplum-script-to-find-running-queries-or-statements-which-are-waiting-in-resource-queues%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20running%20queries%20or%20statements%20which%20are%20Waiting%20in%20Resource%20Queues" 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%2F11%2Fgreenplum-script-to-find-running-queries-or-statements-which-are-waiting-in-resource-queues%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20running%20queries%20or%20statements%20which%20are%20Waiting%20in%20Resource%20Queues" 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%2F11%2Fgreenplum-script-to-find-running-queries-or-statements-which-are-waiting-in-resource-queues%2F&#038;title=Greenplum%3A%20Script%20to%20find%20running%20queries%20or%20statements%20which%20are%20Waiting%20in%20Resource%20Queues" data-a2a-url="https://www.dbrnd.com/2017/11/greenplum-script-to-find-running-queries-or-statements-which-are-waiting-in-resource-queues/" data-a2a-title="Greenplum: Script to find running queries or statements which are Waiting in Resource Queues"></a></p><p>In this post, I am sharing a script to check the list of running queries or statements which are waiting in the Resource Queues of Greenplum. </p>
<blockquote><p>The Workload management of Greenplum means &#8211; Set priorities of database user&#8217;s queries using Resource Queues. If you create RQ with the limit of 10 concurrent queries and user is trying to execute more than 10 queries at a time then few RQ keeps few queries in the waiting mode. </p></blockquote>
<p>Using below query, you can get the list of running queries which are in the waiting mode.</p>
<pre class="crayon-plain-tag">SELECT
	rolname
	,rsqname
	,pid
	,granted
	,current_query
	,datname
FROM pg_roles, gp_toolkit.gp_resqueue_status
,pg_locks, pg_stat_activity
WHERE pg_roles.rolresqueue=pg_locks.objid
	AND pg_locks.objid=gp_toolkit.gp_resqueue_status.queueid
	AND pg_stat_activity.procpid=pg_locks.pid
	AND pg_stat_activity.usename=pg_roles.rolnam</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Greenplum: Script to check the size of Database, Schema and Table (Using gp_toolkit schema)</title>
		<link>https://www.dbrnd.com/2017/11/greenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 18 Nov 2017 16:16:33 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Greenplum 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[gp_size_of_database]]></category>
		<category><![CDATA[gp_size_of_schema_disk]]></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[pg_size_pretty]]></category>
		<category><![CDATA[pg_total_relation_size]]></category>
		<category><![CDATA[PostgreSQL 8.2]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[Table]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6118</guid>

					<description><![CDATA[In this post, I am sharing a few scripts for checking the size of Database, Schema and Table of Greenplum Server. Here, I am doing this exercise using the views of the gp_toolkit schema of Greenplum. Check the size of database in MB, GB and TB: [crayon-6ab3f5a024c60727661304/] Checkt the size of database in MB, GB [&#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%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%29" 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%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%29" 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%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%29" 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%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%29" 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%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%29" 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%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%29" 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%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&#038;title=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%29" data-a2a-url="https://www.dbrnd.com/2017/11/greenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema/" data-a2a-title="Greenplum: Script to check the size of Database, Schema and Table (Using gp_toolkit schema)"></a></p><p>In this post, I am sharing a few scripts for checking the size of Database, Schema and Table of Greenplum Server. </p>
<p>Here, I am doing this exercise using the views of the gp_toolkit schema of Greenplum. </p>
<p><strong>Check the size of database in MB, GB and TB:</strong></p>
<pre class="crayon-plain-tag">SELECT sodddatname, (sodddatsize/1048576) AS Sizein_MB
FROM gp_toolkit.gp_size_of_database;
 
SELECT sodddatname, (sodddatsize/1073741824) AS Sizein_GB
FROM gp_toolkit.gp_size_of_database;
 
SELECT sodddatname, (sodddatsize/1073741824)/1024 AS Sizein_TB
FROM gp_toolkit.gp_size_of_database;</pre> </p>
<p><strong>Checkt the size of database in MB, GB and TB:</strong></p>
<pre class="crayon-plain-tag">SELECT sosdnsp, (sosdschematablesize/1048576) AS Sizein_MB
FROM gp_toolkit.gp_size_of_schema_disk;
 
SELECT sosdnsp, (sosdschematablesize/1073741824) AS Sizein_GB
FROM gp_toolkit.gp_size_of_schema_disk;
 
SELECT sosdnsp, (sosdschematablesize/1073741824)/1024 AS Sizein_TB
FROM gp_toolkit.gp_size_of_schema_disk;</pre> </p>
<p><strong>Check the size of any Table or Index:</strong></p>
<pre class="crayon-plain-tag">SELECT pg_size_pretty(pg_total_relation_size('schema_name.table_name'));</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Greenplum: Script to check the full disk space of DCA</title>
		<link>https://www.dbrnd.com/2017/07/greenplum-script-to-check-the-full-disk-space-of-dca/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 26 Jul 2017 16:16:28 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Greenplum 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[DCA]]></category>
		<category><![CDATA[diskspace_now]]></category>
		<category><![CDATA[gp_disk_free]]></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>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5705</guid>

					<description><![CDATA[In this post, I am sharing two different scripts to check the full size of Greenplum DCA. To monitor the disk space is a ubiquitous task of DBA. DBA can use below script and can automate the report on disk size notification/alert. There are different options to check the disk size of the server; below [&#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%2F07%2Fgreenplum-script-to-check-the-full-disk-space-of-dca%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20full%20disk%20space%20of%20DCA" 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%2F07%2Fgreenplum-script-to-check-the-full-disk-space-of-dca%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20full%20disk%20space%20of%20DCA" 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%2F07%2Fgreenplum-script-to-check-the-full-disk-space-of-dca%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20full%20disk%20space%20of%20DCA" 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%2F07%2Fgreenplum-script-to-check-the-full-disk-space-of-dca%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20full%20disk%20space%20of%20DCA" 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%2F07%2Fgreenplum-script-to-check-the-full-disk-space-of-dca%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20full%20disk%20space%20of%20DCA" 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%2F07%2Fgreenplum-script-to-check-the-full-disk-space-of-dca%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20full%20disk%20space%20of%20DCA" 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%2F07%2Fgreenplum-script-to-check-the-full-disk-space-of-dca%2F&#038;title=Greenplum%3A%20Script%20to%20check%20the%20full%20disk%20space%20of%20DCA" data-a2a-url="https://www.dbrnd.com/2017/07/greenplum-script-to-check-the-full-disk-space-of-dca/" data-a2a-title="Greenplum: Script to check the full disk space of DCA"></a></p><p>In this post, I am sharing two different scripts to check the full size of Greenplum DCA.<br />
To monitor the disk space is a ubiquitous task of DBA. DBA can use below script and can automate the report on disk size notification/alert.</p>
<p>There are different options to check the disk size of the server; below I prepared two queries using gpperfmon database and gp_toolkit schema.</p>
<p><strong>Use gpperfmon Database:</strong></p>
<pre class="crayon-plain-tag">select
	hostname
	,filesystem
	,round(total_bytes/power(1024,4)::numeric,2) as TotalSize_inTB
	,round(bytes_used/power(1024,4)::numeric,2) as UsedSize_inTB
	,round(bytes_available/power(1024,4)::numeric,2) as AvailableSize_inTB
from diskspace_now
where filesystem in ('/data1','/data2')
ORDER BY 4 DESC</pre> </p>
<p><strong>Use gp_toolkit Schema:</strong></p>
<pre class="crayon-plain-tag">select
	distinct dfhostname
	,dfdevice
	,dfspace
from gp_toolkit.gp_disk_free</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Greenplum: Script to find the usage of Work spill file per Running Query</title>
		<link>https://www.dbrnd.com/2017/07/greenplum-script-to-find-the-usage-of-work-spill-file-per-running-query-gp_toolkit-gp_workfile_usage_per_query/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 01 Jul 2017 16:16:04 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Greenplum 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[gp_toolkit]]></category>
		<category><![CDATA[gp_workfile_usage_per_query]]></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[Work Spill file]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5445</guid>

					<description><![CDATA[In this post, I am sharing a script to find the total usage of work spill files for each running query in Greenplum. Whenever we are doing hash aggregation operation like GROUP BY or DISTINCT on billions of data, query executor holds this data in temporary files which called work spill files. We should optimize [&#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%2F07%2Fgreenplum-script-to-find-the-usage-of-work-spill-file-per-running-query-gp_toolkit-gp_workfile_usage_per_query%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20the%20usage%20of%20Work%20spill%20file%20per%20Running%20Query" 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%2F07%2Fgreenplum-script-to-find-the-usage-of-work-spill-file-per-running-query-gp_toolkit-gp_workfile_usage_per_query%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20the%20usage%20of%20Work%20spill%20file%20per%20Running%20Query" 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%2F07%2Fgreenplum-script-to-find-the-usage-of-work-spill-file-per-running-query-gp_toolkit-gp_workfile_usage_per_query%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20the%20usage%20of%20Work%20spill%20file%20per%20Running%20Query" 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%2F07%2Fgreenplum-script-to-find-the-usage-of-work-spill-file-per-running-query-gp_toolkit-gp_workfile_usage_per_query%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20the%20usage%20of%20Work%20spill%20file%20per%20Running%20Query" 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%2F07%2Fgreenplum-script-to-find-the-usage-of-work-spill-file-per-running-query-gp_toolkit-gp_workfile_usage_per_query%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20the%20usage%20of%20Work%20spill%20file%20per%20Running%20Query" 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%2F07%2Fgreenplum-script-to-find-the-usage-of-work-spill-file-per-running-query-gp_toolkit-gp_workfile_usage_per_query%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20the%20usage%20of%20Work%20spill%20file%20per%20Running%20Query" 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%2F07%2Fgreenplum-script-to-find-the-usage-of-work-spill-file-per-running-query-gp_toolkit-gp_workfile_usage_per_query%2F&#038;title=Greenplum%3A%20Script%20to%20find%20the%20usage%20of%20Work%20spill%20file%20per%20Running%20Query" data-a2a-url="https://www.dbrnd.com/2017/07/greenplum-script-to-find-the-usage-of-work-spill-file-per-running-query-gp_toolkit-gp_workfile_usage_per_query/" data-a2a-title="Greenplum: Script to find the usage of Work spill file per Running Query"></a></p><p>In this post, I am sharing a script to find the total usage of work spill files for each running query in Greenplum.</p>
<blockquote><p>Whenever we are doing hash aggregation operation like GROUP BY or DISTINCT on billions of data, query executor holds this data in temporary files which called work spill files.</p></blockquote>
<p>We should optimize our query to reduce the maximum use of work spill files because it degrades the overall performance and also requires more disk space.</p>
<p>Using below script, we can monitor the usage of work spill file for each running query and we can also optimize the long running queries.</p>
<pre class="crayon-plain-tag">SELECT
	gwupq.datname
	,psa.usename
	,gwupq.procpid
	,gwupq.sess_id
	,sum(gwupq.size)/1024::float as total_spill_size_kb
	,sum(gwupq.numfiles) as total_spill_file
FROM  gp_toolkit.gp_workfile_usage_per_query as gwupq
inner join pg_stat_activity psa
	on gwupq.procpid = psa.procpid
	and gwupq.sess_id = psa.sess_id
GROUP BY 1,2,3,4;</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Greenplum: How to check the Database Schema Size?</title>
		<link>https://www.dbrnd.com/2017/06/greenplum-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 29 Jun 2017 16:16:21 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[gp_size_of_schema_disk]]></category>
		<category><![CDATA[gp_toolkit]]></category>
		<category><![CDATA[Greenplum]]></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_namespace]]></category>
		<category><![CDATA[PostgreSQL 8.2]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[size]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5441</guid>

					<description><![CDATA[Greenplum is a based on MVCC architecture that means user&#8217;s action like UPDATE will insert a new record in a database. Greenplum Data warehouse can manage billions of data, but it doesn&#8217;t mean that user can generate or UPDATE random data set. Periodically, The Greenplum DBA should check the size of database schemas and their [&#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-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&amp;linkname=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%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-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&amp;linkname=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%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-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&amp;linkname=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%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-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&amp;linkname=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%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-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&amp;linkname=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%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-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&amp;linkname=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%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-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&#038;title=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%3F" data-a2a-url="https://www.dbrnd.com/2017/06/greenplum-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk/" data-a2a-title="Greenplum: How to check the Database Schema Size?"></a></p><p>Greenplum is a based on MVCC architecture that means user&#8217;s action like UPDATE will insert a new record in a database.<br />
Greenplum Data warehouse can manage billions of data, but it doesn&#8217;t mean that user can generate or UPDATE random data set.<br />
Periodically, The Greenplum DBA should check the size of database schemas and their appropriate usage.</p>
<p>In this post, I shared different scripts to check the size of Greenplum Database Schemas.</p>
<p><strong>Option 1:</strong></p>
<pre class="crayon-plain-tag">select *
from gp_toolkit.gp_size_of_schema_disk;</pre> </p>
<p><strong>Option 2:</strong></p>
<pre class="crayon-plain-tag">select
	schemaname
	,round(sum(pg_total_relation_size(schemaname||'.'||tablename))) SchemaSize
from pg_tables group by 1;</pre> </p>
<p><strong>Option 3:</strong></p>
<pre class="crayon-plain-tag">SELECT
	schema_name
	,pg_size_pretty(sum(table_size)::bigint)
FROM
(
	SELECT pg_catalog.pg_namespace.nspname as schema_name,
	pg_relation_size(pg_catalog.pg_class.oid) as table_size
	FROM pg_catalog.pg_class
	JOIN pg_catalog.pg_namespace ON relnamespace = pg_catalog.pg_namespace.oid
) t
GROUP BY schema_name
ORDER BY schema_name;</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Greenplum: Script to find Work Spill Files usage for all Segments</title>
		<link>https://www.dbrnd.com/2017/06/greenplum-script-to-find-work-spill-files-usage-for-all-segments-gp_toolkit-gp_workfile_entries/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 23 Jun 2017 16:16:16 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Greenplum 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[gp_toolkit]]></category>
		<category><![CDATA[gp_workfile_entries]]></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[Segments]]></category>
		<category><![CDATA[Work Spill file]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5439</guid>

					<description><![CDATA[In this post, I am sharing a script to find the total usage of work spill files for all the segments of Greenplum. Whenever we are doing hash aggregation operations like GROUP BY or DISTINCT on billions of data, query executor holds this data in temporary files which called work spill files. We should optimize [&#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-script-to-find-work-spill-files-usage-for-all-segments-gp_toolkit-gp_workfile_entries%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Work%20Spill%20Files%20usage%20for%20all%20Segments" 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-script-to-find-work-spill-files-usage-for-all-segments-gp_toolkit-gp_workfile_entries%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Work%20Spill%20Files%20usage%20for%20all%20Segments" 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-script-to-find-work-spill-files-usage-for-all-segments-gp_toolkit-gp_workfile_entries%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Work%20Spill%20Files%20usage%20for%20all%20Segments" 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-script-to-find-work-spill-files-usage-for-all-segments-gp_toolkit-gp_workfile_entries%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Work%20Spill%20Files%20usage%20for%20all%20Segments" 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-script-to-find-work-spill-files-usage-for-all-segments-gp_toolkit-gp_workfile_entries%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Work%20Spill%20Files%20usage%20for%20all%20Segments" 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-script-to-find-work-spill-files-usage-for-all-segments-gp_toolkit-gp_workfile_entries%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Work%20Spill%20Files%20usage%20for%20all%20Segments" 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-script-to-find-work-spill-files-usage-for-all-segments-gp_toolkit-gp_workfile_entries%2F&#038;title=Greenplum%3A%20Script%20to%20find%20Work%20Spill%20Files%20usage%20for%20all%20Segments" data-a2a-url="https://www.dbrnd.com/2017/06/greenplum-script-to-find-work-spill-files-usage-for-all-segments-gp_toolkit-gp_workfile_entries/" data-a2a-title="Greenplum: Script to find Work Spill Files usage for all Segments"></a></p><p>In this post, I am sharing a script to find the total usage of work spill files for all the segments of Greenplum.</p>
<blockquote><p>Whenever we are doing hash aggregation operations like GROUP BY or DISTINCT on billions of data, query executor holds this data in temporary files which called work spill files.</p></blockquote>
<p>We should optimize our query to reduce the maximum use of work spill files because it degrades the overall performance and also requires more disk space.<br />
Using below query, you can check the total number of spill files and their size for each segment.</p>
<pre class="crayon-plain-tag">SELECT
                gwe.datname as DatabaseName
                ,psa.usename as UserName
                ,gwe.procpid as ProcessID
                ,gwe.sess_id as SessionID
                ,sc.hostname as HostName
                ,sum(size)/1024::float as SizePerHost
                ,sum(numfiles) NumOfFilesPerHost
FROM  gp_toolkit.gp_workfile_entries as gwe
inner join pg_stat_activity as psa
                on psa.procpid = gwe.procpid
                and psa.sess_id = gwe.sess_id,
gp_segment_configuration as sc
,pg_filespace_entry as fe
,pg_database as d
WHERE fe.fsedbid=sc.dbid
                AND gwe.segid=sc.content
                AND gwe.datname=d.datname
                AND sc.role='p'
group by
                gwe.datname
                ,psa.usename
                ,gwe.procpid
                ,gwe.sess_id
                ,sc.hostname
ORDER BY
                gwe.datname
                ,psa.usename
                ,gwe.procpid
                ,gwe.sess_id
                ,sc.hostname</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
