<?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_workfile_usage_per_query &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/gp_workfile_usage_per_query/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>Thu, 29 Jun 2017 18:38:50 +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 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>
	</channel>
</rss>
