<?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>GPCC &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/gpcc/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>Fri, 22 Sep 2017 20:48:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>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>
	</channel>
</rss>
