<?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>Greenplum &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/greenplum/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:34:04 +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: Script to find Table Fragmentation and total wasted space</title>
		<link>https://www.dbrnd.com/2018/02/greenplum-script-to-find-table-fragmentation-and-total-wasted-space-dead-tuples/</link>
					<comments>https://www.dbrnd.com/2018/02/greenplum-script-to-find-table-fragmentation-and-total-wasted-space-dead-tuples/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 06 Feb 2018 16:16:38 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[bloat]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[dead tuples]]></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[PostgreSQL 8.2]]></category>
		<category><![CDATA[table fragmentation]]></category>
		<category><![CDATA[wasted space]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4368</guid>

					<description><![CDATA[I recently started work with Greenplum Distributed RDBMS. Internally, it is using PostgreSQL 8.2 which is an ancient version of PostgreSQL. I shared a couple of articles on finding the fragmentation in PostgreSQL, but none of my scripts worked for Greenplum PostgreSQL 8.2. I have Posted one question on StackOverflow. Please check this link. Finally, [&#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-script-to-find-table-fragmentation-and-total-wasted-space-dead-tuples%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Table%20Fragmentation%20and%20total%20wasted%20space" 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-script-to-find-table-fragmentation-and-total-wasted-space-dead-tuples%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Table%20Fragmentation%20and%20total%20wasted%20space" 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-script-to-find-table-fragmentation-and-total-wasted-space-dead-tuples%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Table%20Fragmentation%20and%20total%20wasted%20space" 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-script-to-find-table-fragmentation-and-total-wasted-space-dead-tuples%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Table%20Fragmentation%20and%20total%20wasted%20space" 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-script-to-find-table-fragmentation-and-total-wasted-space-dead-tuples%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Table%20Fragmentation%20and%20total%20wasted%20space" 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-script-to-find-table-fragmentation-and-total-wasted-space-dead-tuples%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Table%20Fragmentation%20and%20total%20wasted%20space" 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-script-to-find-table-fragmentation-and-total-wasted-space-dead-tuples%2F&#038;title=Greenplum%3A%20Script%20to%20find%20Table%20Fragmentation%20and%20total%20wasted%20space" data-a2a-url="https://www.dbrnd.com/2018/02/greenplum-script-to-find-table-fragmentation-and-total-wasted-space-dead-tuples/" data-a2a-title="Greenplum: Script to find Table Fragmentation and total wasted space"></a></p><p>I recently started work with Greenplum Distributed RDBMS. Internally, it is using PostgreSQL 8.2 which is an ancient version of PostgreSQL. </p>
<blockquote><p>I shared a couple of articles on finding the fragmentation in PostgreSQL, but none of my scripts worked for Greenplum PostgreSQL 8.2.</p></blockquote>
<p><a href="http://stackoverflow.com/questions/41564856/how-to-find-dead-tuples-fragmentation-in-postgresql-8-2-for-greenplum" target="_blank">I have Posted one question on StackOverflow. Please check this link.</a></p>
<blockquote><p>Finally, I found a script for finding the fragmentation of Greenplum tables which is very important for Greenplum DBA because Greenplum is a based on MVCC architecture which generates dead rows at every UPDATE / DELETE. </p></blockquote>
<blockquote class="wp-embedded-content" data-secret="HUgKW8A8OK"><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=HUgKW8A8OK" data-secret="HUgKW8A8OK" 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 use below script for finding the wasted space of the tables and can execute VACUUM ANALYZE on those tables. </p>
<pre class="crayon-plain-tag">select
	current_database() as dbname
	, relid
	, schemaname
	, tablename
	, round(bloat,1) as bloat_ratio
	, pg_size_pretty(expbytes) as expected_size
	, pg_size_pretty(relbytes) as relation_size
	, pg_size_pretty(wastedbytes) as wasted_space
	, round(1.0 * relbytes / nullif((sum(relbytes) over ())::bigint,0),4) as relative_size
	, round((bloat-1) * (1.0 * relbytes / nullif((sum(relbytes) over ())::bigint, 0)), 8) as concern
from
(
	SELECT
		relid
		, schemaname
		, tablename
		, CASE WHEN otta=0 THEN 
			0.0 
			ELSE 
			sml.relpages/otta::numeric 
			END AS bloat
		, reltuples::bigint
		, relpages::bigint
		, otta
		, (bs*otta)::bigint as expbytes
		, CASE WHEN relpages &lt; otta THEN 0 ELSE 
		(bs*(sml.relpages-otta))::bigint 
		END AS wastedbytes
		, CASE WHEN relpages &lt; otta THEN 0 ELSE relpages::bigint - otta END AS wastedpages
		, (bs*relpages)::bigint as relbytes
	FROM
	(
		SELECT
			schemaname
			, tablename
			, cc.oid as relid
			, cc.reltuples
			, cc.relpages
			, bs
			, CEIL((cc.reltuples*((datahdr+ma-(CASE WHEN datahdr%ma=0 THEN ma ELSE datahdr%ma END))+nullhdr2+4))/(bs-20::float)) AS otta 
		FROM 
		(
			SELECT
				ma
				, bs
				, schemaname
				, tablename
				, (datawidth+(hdr+ma-(case when hdr%ma=0 THEN ma ELSE hdr%ma END)))::numeric AS datahdr
				, (maxfracsum*(nullhdr+ma-(case when nullhdr%ma=0 THEN ma ELSE nullhdr%ma END))) AS nullhdr2
			FROM
			(
				SELECT
					schemaname
					, tablename
					, hdr
					, ma
					, bs
					, SUM((1-s.null_frac)*avg_width) AS datawidth
					, MAX(s.null_frac) AS maxfracsum
					, hdr+(1+(count(case when s.null_frac&lt;&gt;0 then 1 end))/8) as nullhdr
				FROM 
				pg_stats s
				cross join 
				(
					SELECT
					current_setting('block_size')::numeric AS bs
					, CASE WHEN substring(version(),12,3) IN ('8.0','8.1','8.2') THEN 27 ELSE 23 END AS hdr
					, CASE WHEN version() ~ 'mingw32' THEN 8 ELSE 4 END AS ma
				) AS constants
				GROUP BY schemaname, tablename, hdr, ma, bs
			) AS foo
		) AS rs
		JOIN pg_class cc 
		ON
		cc.relname = rs.tablename 
		and cc.relkind = 'r'
		JOIN pg_namespace nn 
		ON
		cc.relnamespace = nn.oid 
		AND nn.nspname = rs.schemaname 
	) AS sml
) wrapper
where wastedbytes &gt; 2*1024*1024 and bloat &gt;= 1.4order by (bloat-1) * (1.0 * relbytes / nullif((sum(relbytes) over ())::bigint, 0)) desc;</pre> </p>
<p><strong><a href="http://www.dbaref.com/home/greenplum-dba-quick-reference/checkingbloatswithcustomizedscripts" target="_blank">Taken reference from this article </a></strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/02/greenplum-script-to-find-table-fragmentation-and-total-wasted-space-dead-tuples/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 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: How to Troubleshoot running Database Backup Process</title>
		<link>https://www.dbrnd.com/2018/02/greenplum-how-to-troubleshoot-running-database-backup-process-starting-dump-process-releasing-pg_class-lock/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 03 Feb 2018 16:16:57 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[gpcrondump]]></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[parallel backup]]></category>
		<category><![CDATA[PostgreSQL 8.2]]></category>
		<category><![CDATA[Releasing pg_class lock]]></category>
		<category><![CDATA[Starting Dump process]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4412</guid>

					<description><![CDATA[<div><img width="454" height="200" src="https://www.dbrnd.com/wp-content/uploads/2018/01/Database-Backup.png" class="attachment-post-image size-post-image wp-post-image" alt="Database Backup" decoding="async" fetchpriority="high" /></div>Greenplum is based on MPP (massively parallel processing) architecture. It built on shared nothing mode parallel processing in which all child segments own separate resources. Database Theory: What is Parallel Query Processing (Parallel Database System)? When you are taking database backup in Greenplum, it executes a backup process in different stages and executes in parallel. [&#8230;]]]></description>
										<content:encoded><![CDATA[<div><img width="454" height="200" src="https://www.dbrnd.com/wp-content/uploads/2018/01/Database-Backup.png" class="attachment-post-image size-post-image wp-post-image" alt="Database Backup" decoding="async" loading="lazy" /></div><p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fgreenplum-how-to-troubleshoot-running-database-backup-process-starting-dump-process-releasing-pg_class-lock%2F&amp;linkname=Greenplum%3A%20How%20to%20Troubleshoot%20running%20Database%20Backup%20Process" 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-how-to-troubleshoot-running-database-backup-process-starting-dump-process-releasing-pg_class-lock%2F&amp;linkname=Greenplum%3A%20How%20to%20Troubleshoot%20running%20Database%20Backup%20Process" 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-how-to-troubleshoot-running-database-backup-process-starting-dump-process-releasing-pg_class-lock%2F&amp;linkname=Greenplum%3A%20How%20to%20Troubleshoot%20running%20Database%20Backup%20Process" 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-how-to-troubleshoot-running-database-backup-process-starting-dump-process-releasing-pg_class-lock%2F&amp;linkname=Greenplum%3A%20How%20to%20Troubleshoot%20running%20Database%20Backup%20Process" 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-how-to-troubleshoot-running-database-backup-process-starting-dump-process-releasing-pg_class-lock%2F&amp;linkname=Greenplum%3A%20How%20to%20Troubleshoot%20running%20Database%20Backup%20Process" 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-how-to-troubleshoot-running-database-backup-process-starting-dump-process-releasing-pg_class-lock%2F&amp;linkname=Greenplum%3A%20How%20to%20Troubleshoot%20running%20Database%20Backup%20Process" 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-how-to-troubleshoot-running-database-backup-process-starting-dump-process-releasing-pg_class-lock%2F&#038;title=Greenplum%3A%20How%20to%20Troubleshoot%20running%20Database%20Backup%20Process" data-a2a-url="https://www.dbrnd.com/2018/02/greenplum-how-to-troubleshoot-running-database-backup-process-starting-dump-process-releasing-pg_class-lock/" data-a2a-title="Greenplum: How to Troubleshoot running Database Backup Process"></a></p><p>Greenplum is based on MPP (massively parallel processing) architecture. It built on shared nothing mode parallel processing in which all child segments own separate resources. </p>
<blockquote class="wp-embedded-content" data-secret="8v1oAOBKRV"><p><a href="https://www.dbrnd.com/2016/11/database-theory-what-is-parallel-query-processing-parallel-database-system/">Database Theory: What is Parallel Query Processing (Parallel Database System)?</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/11/database-theory-what-is-parallel-query-processing-parallel-database-system/embed/#?secret=8v1oAOBKRV" data-secret="8v1oAOBKRV" width="600" height="338" title="&#8220;Database Theory: What is Parallel Query Processing (Parallel Database System)?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>When you are taking database backup in Greenplum, it executes a backup process in different stages and executes in parallel. </p>
<blockquote><p>For GP DBA, this is very important for knowing that in which machine or segment backup process is running. They may have few other questions like Is backup process completed for a master segment?, If it is completed for a master segment, in which child segment it is running currently.</p></blockquote>
<p>You can access this article for troubleshooting Greenplum running database backup process.</p>
<p><strong>You can start Greenplum full database backup using below command:</strong></p>
<pre class="crayon-plain-tag">gpcrondump -x database_name -u /home/gpadmin/dbrnd_backup/</pre> </p>
<p>It first takes a backup of the master node (all metadata or pg_catalog), while during this time you cannot perform any DDL or any other operation on Greenplum database server like CREATE TABLE, DROP TABLE, TRUNCATE TABLE.<br />
It takes only a few minutes to complete the backup of a master node.</p>
<p><strong>How can you check that, Is Greenplum database backup process running on master node?</strong></p>
<blockquote><p>The first step is to check if the message <strong>&#8220;Starting Dump process&#8221;</strong> is on the screen<br />
After this message, you can find a subsequent message <strong>&#8220;Releasing pg_class lock&#8221;</strong> that means backup process completed for master segment (meta data backup).</p></blockquote>
<blockquote><p>You can measure the time difference between &#8220;Starting Dump process&#8221; and &#8220;Releasing pg_class lock&#8221; that is the total time taken for master segment backup. </p></blockquote>
<blockquote><p>
If you are unable to find &#8220;Releasing pg_class lock&#8221; on the screen and find only &#8220;Starting Dump process&#8221; for a long time, there is 99% problem with a master segment and problem like database lock, network issue, disk failure. </p></blockquote>
<p><strong>How can we check that, Is Greenplum database backup process running on child nodes?</strong></p>
<blockquote><p>After taken a master node back up, a gp_dump command will be sent to all the segments to start a copy of the data using COPY command.</p></blockquote>
<blockquote><p>We can check the running processes in child nodes and can find COPY command and db_dumps directory in the process list. You can get the list of Linux running processes using a command: ps -ef.<br />
Below is a sample process message:</p>
<pre class="crayon-plain-tag">postgres: port 40002, gpadmin database_name [local] con808 [local] cmd880 COPY</pre>
</p></blockquote>
<p><strong>Important Note: </strong></p>
<blockquote><p>Please do not kill long running Greenplum backup from only master node because it may continue the backup process on child segments. Your one wrong kill command can fail your whole Greenplum cluster. </p></blockquote>
<p><em><br />
If you guys know how to kill long running backup in Greenplum, please share full detail with me because I am also looking for the solution for killing backup process at all child segments. </em></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Greenplum: Script to find blocked and deadlock by other blocking queries</title>
		<link>https://www.dbrnd.com/2018/02/greenplum-script-to-find-blocked-and-deadlock-by-other-blocking-queries-pg_locks/</link>
					<comments>https://www.dbrnd.com/2018/02/greenplum-script-to-find-blocked-and-deadlock-by-other-blocking-queries-pg_locks/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 02 Feb 2018 16:16:41 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[DeadLock]]></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[lock]]></category>
		<category><![CDATA[long running queries]]></category>
		<category><![CDATA[PostgreSQL 8.2]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4394</guid>

					<description><![CDATA[In this post, I am sharing a script to find a list of blocked and deadlock queries by other blocking queries of Greenplum Database Server. You can visit below article to know more about, what is a lock, deadlock, block and timeout? Database Theory: What is Timeout, Lock, Block, and Deadlock in a Database System? [&#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-script-to-find-blocked-and-deadlock-by-other-blocking-queries-pg_locks%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20blocked%20and%20deadlock%20by%20other%20blocking%20queries" 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-script-to-find-blocked-and-deadlock-by-other-blocking-queries-pg_locks%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20blocked%20and%20deadlock%20by%20other%20blocking%20queries" 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-script-to-find-blocked-and-deadlock-by-other-blocking-queries-pg_locks%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20blocked%20and%20deadlock%20by%20other%20blocking%20queries" 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-script-to-find-blocked-and-deadlock-by-other-blocking-queries-pg_locks%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20blocked%20and%20deadlock%20by%20other%20blocking%20queries" 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-script-to-find-blocked-and-deadlock-by-other-blocking-queries-pg_locks%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20blocked%20and%20deadlock%20by%20other%20blocking%20queries" 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-script-to-find-blocked-and-deadlock-by-other-blocking-queries-pg_locks%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20blocked%20and%20deadlock%20by%20other%20blocking%20queries" 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-script-to-find-blocked-and-deadlock-by-other-blocking-queries-pg_locks%2F&#038;title=Greenplum%3A%20Script%20to%20find%20blocked%20and%20deadlock%20by%20other%20blocking%20queries" data-a2a-url="https://www.dbrnd.com/2018/02/greenplum-script-to-find-blocked-and-deadlock-by-other-blocking-queries-pg_locks/" data-a2a-title="Greenplum: Script to find blocked and deadlock by other blocking queries"></a></p><p>In this post, I am sharing a script to find a list of blocked and deadlock queries by other blocking queries of Greenplum Database Server. </p>
<p>You can visit below article to know more about, what is a lock, deadlock, block and timeout?</p>
<blockquote class="wp-embedded-content" data-secret="CZy0OcEdgM"><p><a href="https://www.dbrnd.com/2016/04/database-theory-what-is-timeout-lock-block-and-deadlock-in-a-database-system/">Database Theory: What is Timeout, Lock, Block, and Deadlock in a Database System?</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/04/database-theory-what-is-timeout-lock-block-and-deadlock-in-a-database-system/embed/#?secret=CZy0OcEdgM" data-secret="CZy0OcEdgM" width="600" height="338" title="&#8220;Database Theory: What is Timeout, Lock, Block, and Deadlock in a Database System?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>If two queries are trying to get the same resource, both are depended on each other and generates block state first and then deadlock.</p>
<blockquote><p>In the below script, you can find a list of blocked queries and blocker queries with a value of time age.<br />
You can find a process_id of blocker query which we can kill for avoiding the deadlock situation.</p></blockquote>
<pre class="crayon-plain-tag">SELECT
	kl.pid as blocking_pid
	,ka.usename as blocking_user
	,ka.current_query as blocking_query
	,bl.pid as blocked_pid
	,a.usename as blocked_user
	,a.current_query as blocked_query
	,to_char(age(now(), a.query_start),'HH24h:MIm:SSs') as age
FROM pg_catalog.pg_locks bl
JOIN pg_catalog.pg_stat_activity a
	ON bl.pid = a.procpid
JOIN pg_catalog.pg_locks kl
	ON bl.locktype = kl.locktype
	and bl.database is not distinct from kl.database
	and bl.relation is not distinct from kl.relation
	and bl.page is not distinct from kl.page
	and bl.tuple is not distinct from kl.tuple
	and bl.transactionid is not distinct from kl.transactionid
	and bl.classid is not distinct from kl.classid
	and bl.objid is not distinct from kl.objid
	and bl.objsubid is not distinct from kl.objsubid
	and bl.pid &lt;&gt; kl.pid
JOIN pg_catalog.pg_stat_activity ka
	ON kl.pid = ka.procpid
WHERE kl.granted and not bl.granted
ORDER BY a.query_start;</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/02/greenplum-script-to-find-blocked-and-deadlock-by-other-blocking-queries-pg_locks/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Greenplum: Find long running sessions with lock information</title>
		<link>https://www.dbrnd.com/2018/02/greenplum-find-long-running-sessions-with-lock-information-total-execution-time/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 01 Feb 2018 16:16:29 +0000</pubDate>
				<category><![CDATA[Greenplum]]></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[lock]]></category>
		<category><![CDATA[long running queries]]></category>
		<category><![CDATA[PostgreSQL 8.2]]></category>
		<category><![CDATA[sessions]]></category>
		<category><![CDATA[transactions]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4387</guid>

					<description><![CDATA[In this post, I am sharing a script to find long running queries or sessions with the lock information of Greenplum database server. In the below script, you can find the age column which gives you total execution time of running sessions. You can also find query lock related details. [crayon-6ab5c59fedec8728180829/]]]></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-find-long-running-sessions-with-lock-information-total-execution-time%2F&amp;linkname=Greenplum%3A%20Find%20long%20running%20sessions%20with%20lock%20information" 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-find-long-running-sessions-with-lock-information-total-execution-time%2F&amp;linkname=Greenplum%3A%20Find%20long%20running%20sessions%20with%20lock%20information" 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-find-long-running-sessions-with-lock-information-total-execution-time%2F&amp;linkname=Greenplum%3A%20Find%20long%20running%20sessions%20with%20lock%20information" 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-find-long-running-sessions-with-lock-information-total-execution-time%2F&amp;linkname=Greenplum%3A%20Find%20long%20running%20sessions%20with%20lock%20information" 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-find-long-running-sessions-with-lock-information-total-execution-time%2F&amp;linkname=Greenplum%3A%20Find%20long%20running%20sessions%20with%20lock%20information" 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-find-long-running-sessions-with-lock-information-total-execution-time%2F&amp;linkname=Greenplum%3A%20Find%20long%20running%20sessions%20with%20lock%20information" 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-find-long-running-sessions-with-lock-information-total-execution-time%2F&#038;title=Greenplum%3A%20Find%20long%20running%20sessions%20with%20lock%20information" data-a2a-url="https://www.dbrnd.com/2018/02/greenplum-find-long-running-sessions-with-lock-information-total-execution-time/" data-a2a-title="Greenplum: Find long running sessions with lock information"></a></p><p>In this post, I am sharing a script to find long running queries or sessions with the lock information of Greenplum database server. </p>
<p>In the below script, you can find the age column which gives you total execution time of running sessions. You can also find query lock related details.</p>
<pre class="crayon-plain-tag">select 
	age(now(),pg_stat_activity.query_start) as "age",
	pg_stat_activity.datname, pg_stat_activity.usename,
	pg_stat_activity.client_addr, pg_stat_activity.application_name,
	pg_locks.transactionid, pg_locks.transaction,
	pg_stat_activity.procpid, pg_stat_activity.query_start,
	pg_locks.mode, pg_stat_activity.current_query
from  pg_stat_activity, pg_locks
where pg_locks.pid = pg_stat_activity.procpid
and procpid &lt;&gt; pg_backend_pid()
and pg_locks.transactionid = pg_locks.transaction
order by 1 desc;</pre> </p>
]]></content:encoded>
					
		
		
			</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: How to Start and Stop Database?</title>
		<link>https://www.dbrnd.com/2017/11/greenplum-how-to-start-and-stop-database/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 28 Nov 2017 16:16:48 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[gpstart]]></category>
		<category><![CDATA[gpstop]]></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=6137</guid>

					<description><![CDATA[In this post, I am sharing few utility commands which we can use to start and stop the Greenplum Database Cluster. Start the database cluster: The gpstart utility starts the database on Greenplum cluster. [crayon-6ab5c59fee7ec148584112/] Restart the database cluster: [crayon-6ab5c59fee7ee989389328/] Reload the configuation: It reloads the pg_hba.conf and postgresql.conf file. [crayon-6ab5c59fee7ef453136356/] Stop the database cluster: [&#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-how-to-start-and-stop-database%2F&amp;linkname=Greenplum%3A%20How%20to%20Start%20and%20Stop%20Database%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%2F11%2Fgreenplum-how-to-start-and-stop-database%2F&amp;linkname=Greenplum%3A%20How%20to%20Start%20and%20Stop%20Database%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%2F11%2Fgreenplum-how-to-start-and-stop-database%2F&amp;linkname=Greenplum%3A%20How%20to%20Start%20and%20Stop%20Database%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%2F11%2Fgreenplum-how-to-start-and-stop-database%2F&amp;linkname=Greenplum%3A%20How%20to%20Start%20and%20Stop%20Database%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%2F11%2Fgreenplum-how-to-start-and-stop-database%2F&amp;linkname=Greenplum%3A%20How%20to%20Start%20and%20Stop%20Database%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%2F11%2Fgreenplum-how-to-start-and-stop-database%2F&amp;linkname=Greenplum%3A%20How%20to%20Start%20and%20Stop%20Database%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%2F11%2Fgreenplum-how-to-start-and-stop-database%2F&#038;title=Greenplum%3A%20How%20to%20Start%20and%20Stop%20Database%3F" data-a2a-url="https://www.dbrnd.com/2017/11/greenplum-how-to-start-and-stop-database/" data-a2a-title="Greenplum: How to Start and Stop Database?"></a></p><p>In this post, I am sharing few utility commands which we can use to start and stop the Greenplum Database Cluster. </p>
<p><strong>Start the database cluster:</strong><br />
The gpstart utility starts the database on Greenplum cluster.</p>
<pre class="crayon-plain-tag">gpstart</pre> </p>
<p><strong>Restart the database cluster:</strong></p>
<pre class="crayon-plain-tag">gpstop -r</pre> </p>
<p><strong>Reload the configuation:</strong><br />
It reloads the pg_hba.conf and postgresql.conf file. </p>
<pre class="crayon-plain-tag">gpstop -u</pre> </p>
<p><strong>Stop the database cluster:</strong><br />
It stops all the processes, master-child segment instances, parallel worker.</p>
<pre class="crayon-plain-tag">gpstop</pre> </p>
<p><strong>Stop the database cluster in fast mode:</strong></p>
<pre class="crayon-plain-tag">gpstop -M fast</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Greenplum: Script to find information for Long running Queries with occupied resource</title>
		<link>https://www.dbrnd.com/2017/11/greenplum-script-to-find-information-for-long-running-queries-with-occupied-resource/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 26 Nov 2017 16:16:39 +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[GPCC]]></category>
		<category><![CDATA[GPPERFMON]]></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[queries_history]]></category>
		<category><![CDATA[system_history]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6139</guid>

					<description><![CDATA[In this post, I am sharing a script to find the average running time and average resource utilization of running queries in Greenplum. I am using the table of GPCC which are available in GPPERFMON database. So if you don&#8217;t configure GPCC, you can&#8217;t use below query. Using below query, you can find the total [&#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-information-for-long-running-queries-with-occupied-resource%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20information%20for%20Long%20running%20Queries%20with%20occupied%20resource" 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-information-for-long-running-queries-with-occupied-resource%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20information%20for%20Long%20running%20Queries%20with%20occupied%20resource" 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-information-for-long-running-queries-with-occupied-resource%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20information%20for%20Long%20running%20Queries%20with%20occupied%20resource" 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-information-for-long-running-queries-with-occupied-resource%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20information%20for%20Long%20running%20Queries%20with%20occupied%20resource" 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-information-for-long-running-queries-with-occupied-resource%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20information%20for%20Long%20running%20Queries%20with%20occupied%20resource" 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-information-for-long-running-queries-with-occupied-resource%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20information%20for%20Long%20running%20Queries%20with%20occupied%20resource" 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-information-for-long-running-queries-with-occupied-resource%2F&#038;title=Greenplum%3A%20Script%20to%20find%20information%20for%20Long%20running%20Queries%20with%20occupied%20resource" data-a2a-url="https://www.dbrnd.com/2017/11/greenplum-script-to-find-information-for-long-running-queries-with-occupied-resource/" data-a2a-title="Greenplum: Script to find information for Long running Queries with occupied resource"></a></p><p>In this post, I am sharing a script to find the average running time and average resource utilization of running queries in Greenplum. </p>
<p>I am using the table of GPCC which are available in GPPERFMON database. So if you don&#8217;t configure GPCC, you can&#8217;t use below query. </p>
<p>Using below query, you can find the total average run time, average CPU, average Memory occupied by long-running queries which took more than 20 minutes and checking for only last 10 days.<br />
As per your requirement, you can change the minutes and days filter value. </p>
<pre class="crayon-plain-tag">select
	sh.ctime
	,query_text
	,username
	,db as DatabaseName
	,rsqname as ResourceQueueName
	,avg(tfinish-tstart) as AverageRunTime
	,count(*) as TotalExecution
	,round(avg(100 - cpu_idle)::numeric,2) as AverageCPUUsed
	,round(max(100 - cpu_idle)::numeric,2) as MaxCPUUsed
	,round(avg(mem_actual_used)/power(1024,3)::numeric,2) as AverageMemoryUsed
	,round(max(mem_actual_used)/power(1024,3)::numeric,2) as MaxMemoryUsed
from system_history sh, queries_history qh
where sh.ctime between date_trunc('day',localtimestamp - interval '10 days')
	and date_trunc('day',localtimestamp)
	and sh.ctime=qh.ctime
	and db not in ('gpperfmon')
	and date_part('hour',tfinish - tstart)*60 + date_part('minute',tfinish - tstart) &gt; 20
group by sh.ctime,query_text,username, db,rsqname;</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-6ab5c59ff00a0023465931/] 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>
	</channel>
</rss>
