<?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>pg_log &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/pg_log/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>Wed, 15 Feb 2017 19:04:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>PostgreSQL: pg_rotate_logfile to Switch and Rotate the server log file (pg_log)</title>
		<link>https://www.dbrnd.com/2017/02/postgresql-pg_rotate_logfile-to-switch-and-rotate-the-server-log-file-pg_log/</link>
					<comments>https://www.dbrnd.com/2017/02/postgresql-pg_rotate_logfile-to-switch-and-rotate-the-server-log-file-pg_log/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 09 Feb 2017 16:16:43 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[pg_log]]></category>
		<category><![CDATA[pg_rotate_logfile]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Monitoring]]></category>
		<category><![CDATA[PostgreSQL Performance Tuning]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[rotate log file]]></category>
		<category><![CDATA[switch log file]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4493</guid>

					<description><![CDATA[If you don&#8217;t know the difference between pg_log, pg_clog and pg_xlog directories, please visit the below article. PostgreSQL: Difference between pg_log, pg_clog and pg_xlog log directories In the PostgreSQL, you can switch or rotate your server log file of a pg_log directory using pg_rotate_logfile(). It is mostly available in all versions of PostgreSQL. Why do [&#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%2F02%2Fpostgresql-pg_rotate_logfile-to-switch-and-rotate-the-server-log-file-pg_log%2F&amp;linkname=PostgreSQL%3A%20pg_rotate_logfile%20to%20Switch%20and%20Rotate%20the%20server%20log%20file%20%28pg_log%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%2F02%2Fpostgresql-pg_rotate_logfile-to-switch-and-rotate-the-server-log-file-pg_log%2F&amp;linkname=PostgreSQL%3A%20pg_rotate_logfile%20to%20Switch%20and%20Rotate%20the%20server%20log%20file%20%28pg_log%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%2F02%2Fpostgresql-pg_rotate_logfile-to-switch-and-rotate-the-server-log-file-pg_log%2F&amp;linkname=PostgreSQL%3A%20pg_rotate_logfile%20to%20Switch%20and%20Rotate%20the%20server%20log%20file%20%28pg_log%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%2F02%2Fpostgresql-pg_rotate_logfile-to-switch-and-rotate-the-server-log-file-pg_log%2F&amp;linkname=PostgreSQL%3A%20pg_rotate_logfile%20to%20Switch%20and%20Rotate%20the%20server%20log%20file%20%28pg_log%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%2F02%2Fpostgresql-pg_rotate_logfile-to-switch-and-rotate-the-server-log-file-pg_log%2F&amp;linkname=PostgreSQL%3A%20pg_rotate_logfile%20to%20Switch%20and%20Rotate%20the%20server%20log%20file%20%28pg_log%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%2F02%2Fpostgresql-pg_rotate_logfile-to-switch-and-rotate-the-server-log-file-pg_log%2F&amp;linkname=PostgreSQL%3A%20pg_rotate_logfile%20to%20Switch%20and%20Rotate%20the%20server%20log%20file%20%28pg_log%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%2F02%2Fpostgresql-pg_rotate_logfile-to-switch-and-rotate-the-server-log-file-pg_log%2F&#038;title=PostgreSQL%3A%20pg_rotate_logfile%20to%20Switch%20and%20Rotate%20the%20server%20log%20file%20%28pg_log%29" data-a2a-url="https://www.dbrnd.com/2017/02/postgresql-pg_rotate_logfile-to-switch-and-rotate-the-server-log-file-pg_log/" data-a2a-title="PostgreSQL: pg_rotate_logfile to Switch and Rotate the server log file (pg_log)"></a></p><p>If you don&#8217;t know the difference between pg_log, pg_clog and pg_xlog directories, please visit the below article.</p>
<blockquote class="wp-embedded-content" data-secret="GXLNOY8V0r"><p><a href="https://www.dbrnd.com/2016/12/postgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log/">PostgreSQL: Difference between pg_log, pg_clog and pg_xlog log directories</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/12/postgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log/embed/#?secret=GXLNOY8V0r" data-secret="GXLNOY8V0r" width="600" height="338" title="&#8220;PostgreSQL: Difference between pg_log, pg_clog and pg_xlog log directories&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>In the PostgreSQL, you can switch or rotate your server log file of a pg_log directory using pg_rotate_logfile(). It is mostly available in all versions of PostgreSQL.</p>
<p><strong>Why do we require to do this?</strong></p>
<blockquote><p>Let me share a small example; We are doing ETL operations like data migration, data processing. Let&#8217;s assume that, senior database manager wants to know PostgreSQL Server log after every four hours.</p></blockquote>
<blockquote><p>You suppose to send a new log file to senior DBA group at after every four hours.</p></blockquote>
<p>The simplest solution is, switch or rotate your PostgreSQL database log file at every four hours. For this, you can configure LINUX Cron job, PGAgent job and can take help of any other OS Scheduler.</p>
<p>Once you create a new file, you can send an old log file which has last four hours of PostgreSQL Logs.</p>
<p>Only, you could execute below query, and it will generate a new log file immediately in a pg_log directory.<br />
<pre class="crayon-plain-tag">SELECT *FROM pg_rotate_logfile()</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/02/postgresql-pg_rotate_logfile-to-switch-and-rotate-the-server-log-file-pg_log/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: Difference between pg_log, pg_clog and pg_xlog log directories</title>
		<link>https://www.dbrnd.com/2016/12/postgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log/</link>
					<comments>https://www.dbrnd.com/2016/12/postgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 04 Dec 2016 14:29:42 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[binary log]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[pg_clog]]></category>
		<category><![CDATA[pg_log]]></category>
		<category><![CDATA[pg_xlog]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Point in time recovery]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[Replication]]></category>
		<category><![CDATA[transaction log]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3979</guid>

					<description><![CDATA[In this post, I am sharing the basic purpose of pg_log, pg_clog and pg_xlog log directories in PostgreSQL. If you look into your PostgreSQL data directory, you can find a different type of log folders. pg_log: This is a default database logs like: error messages, executed query log, dead lock information, Postgers start/stop messages. First, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fpostgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log%2F&amp;linkname=PostgreSQL%3A%20Difference%20between%20pg_log%2C%20pg_clog%20and%20pg_xlog%20log%20directories" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fpostgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log%2F&amp;linkname=PostgreSQL%3A%20Difference%20between%20pg_log%2C%20pg_clog%20and%20pg_xlog%20log%20directories" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fpostgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log%2F&amp;linkname=PostgreSQL%3A%20Difference%20between%20pg_log%2C%20pg_clog%20and%20pg_xlog%20log%20directories" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fpostgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log%2F&amp;linkname=PostgreSQL%3A%20Difference%20between%20pg_log%2C%20pg_clog%20and%20pg_xlog%20log%20directories" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fpostgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log%2F&amp;linkname=PostgreSQL%3A%20Difference%20between%20pg_log%2C%20pg_clog%20and%20pg_xlog%20log%20directories" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fpostgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log%2F&amp;linkname=PostgreSQL%3A%20Difference%20between%20pg_log%2C%20pg_clog%20and%20pg_xlog%20log%20directories" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fpostgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log%2F&#038;title=PostgreSQL%3A%20Difference%20between%20pg_log%2C%20pg_clog%20and%20pg_xlog%20log%20directories" data-a2a-url="https://www.dbrnd.com/2016/12/postgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log/" data-a2a-title="PostgreSQL: Difference between pg_log, pg_clog and pg_xlog log directories"></a></p><p>In this post, I am sharing the basic purpose of pg_log, pg_clog and pg_xlog log directories in PostgreSQL. </p>
<p>If you look into your PostgreSQL data directory, you can find a different type of log folders. </p>
<p><strong>pg_log:</strong> </p>
<blockquote><p>This is a default database logs like: error messages, executed query log, dead lock information, Postgers start/stop messages.</p></blockquote>
<blockquote><p>First, you should look into this folder for any investigation. Most of the time we are getting an error because of bad queries or wrong configuration so in these cases we can find the important log messages from this folder. </p></blockquote>
<blockquote><p>You can also delete unwanted or old log files because It stores only database action related messages which are not critical for PostgreSQL Server.<br />
There are a few parameters in Postgres.conf file related to pg_log folder, you access below article for this. </p></blockquote>
<blockquote data-secret="nhEUfNZ4Cg" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2015/11/postgresql-important-parameters-to-enable-log-for-all-queries/">PostgreSQL: Important Parameters to enable Log for all Queries</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/11/postgresql-important-parameters-to-enable-log-for-all-queries/embed/#?secret=nhEUfNZ4Cg" data-secret="nhEUfNZ4Cg" width="600" height="338" title="&#8220;PostgreSQL: Important Parameters to enable Log for all Queries&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>pg_clog:</strong> </p>
<blockquote><p>We cannot read log files of this folder because it is for PostgreSQL internals. It contains logs for transaction metadata. PostgreSQL server access this folder to take the decision like which transaction completed or which did not. </p></blockquote>
<blockquote><p>This is critical log folder, you should never forget this folder during your pg_data directory backup. </p></blockquote>
<p><strong>pg_xlog:</strong> </p>
<blockquote><p>At all the times, PostgreSQL maintains a write-ahead log (WAL) in the pg_xlog/ subdirectory of the cluster&#8217;s data directory. The log records for every change made to the database&#8217;s data files. These log messages exists primarily for crash-safety purposes.</p></blockquote>
<blockquote><p>It contains the main binary transaction log data or binary log files. If you are planning for replication or Point in time Recovery, we can use this transaction log files. </p></blockquote>
<blockquote><p>We cannot delete this file. Otherwise, it causes a database corruption. The size of this folder would be greater than actual data so If you are dealing with massive database, 99% chance to face disk space related issues especially for the pg_xlog folder. </p></blockquote>
<blockquote><p>But don&#8217;t worry, There are multiple ways to optimize pg_xlog folder by removing old WAL files.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/12/postgresql-difference-between-pg_log-pg_clog-and-pg_xlog-log-directories-transaction-log-binary-log/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
