<?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>infinite possibility &#187; PostgreSQL</title>
	<atom:link href="http://anypossibility.com/blog/category/postgresql/feed/" rel="self" type="application/rss+xml" />
	<link>http://anypossibility.com/blog</link>
	<description>Naoko Reeves&#039;s Blog</description>
	<lastBuildDate>Sun, 19 Feb 2012 04:22:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PostgreSQL Utility for EnterpriseDB Installation</title>
		<link>http://anypossibility.com/blog/2012/01/postgresql-utility-for-enterprisedb-installation/</link>
		<comments>http://anypossibility.com/blog/2012/01/postgresql-utility-for-enterprisedb-installation/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 05:00:05 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[System Admin]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=382</guid>
		<description><![CDATA[PostgreSQL Installer provided by EnterpriseDB is so handy and make your life very easy for OS X Desktop installation. Maybe I just don&#8217;t know the handy utility but I wrote a shell script to control/display various tasks hence I wanted to share this with you. The utility contains: start &#124; stop &#124; restart &#124; stopfast [...]]]></description>
			<content:encoded><![CDATA[<p>PostgreSQL Installer provided by EnterpriseDB is so handy and make your life very easy for OS X Desktop installation.</p>
<p>Maybe I just don&#8217;t know the handy utility but I wrote a shell script to control/display various tasks hence I wanted to share this with you.</p>
<p>The utility contains: start | stop | restart | stopfast | stopnow | status | vac_status | show_connections | version | restore backup</p>
<blockquote>
<pre></pre>
<pre>NODE_NAME=`uname -n`</pre>
<pre>NODE_NAME=${NODE_NAME%%\.*local}</pre>
<pre>NODE_NUMBER=${NODE_NAME##*SQL-}</pre>
<pre>PGBIN=/Library/PostgreSQL/9.1/bin</pre>
<pre>PGDATA=/Library/PostgreSQL/9.1/data</pre>
<pre>pidof(){</pre>
<pre># usage: `pidof`</pre>
<pre>ps -ef | grep postgres | awk '{if ($3==1)print $2}'</pre>
<pre>}</pre>
<pre>start(){</pre>
<pre>pid=`pidof`</pre>
<pre>if [ "$pid" == "" ] ; then</pre>
<pre>echo "Starting postgres..."</pre>
<pre>su - postgres -c "${PGBIN}/pg_ctl -w start -D ${PGDATA} -l ${PGDATA}/pg_log/startup.log"</pre>
<pre>else</pre>
<pre>status</pre>
<pre>fi</pre>
<pre>}</pre>
<pre>stop(){</pre>
<pre>pid=`pidof`</pre>
<pre>if [ "$pid" != "" ] ; then</pre>
<pre>echo "Stopping postgres..."</pre>
<pre>su - postgres -c "${PGBIN}/pg_ctl stop -m smart -w -D ${PGDATA}"</pre>
<pre>else</pre>
<pre>echo "Postgres is not running"</pre>
<pre>fi</pre>
<pre>}</pre>
<pre>stopfast(){</pre>
<pre>pid=`pidof`</pre>
<pre>if [ "$pid" != "" ] ; then</pre>
<pre>echo "Stopping postgres..."</pre>
<pre>su - postgres -c "${PGBIN}/pg_ctl stop -m fast -w -D ${PGDATA}"</pre>
<pre>else</pre>
<pre>echo "Postgres is not running"</pre>
<pre>fi</pre>
<pre>}</pre>
<pre>stopnow(){</pre>
<pre>pid=`pidof`</pre>
<pre>if [ "$pid" != "" ] ; then</pre>
<pre>echo "Stopping postgres..."</pre>
<pre>su - postgres -c "${PGBIN}/pg_ctl stop -m immediate -w -D ${PGDATA}"</pre>
<pre>else</pre>
<pre>echo "Postgres is not running"</pre>
<pre>fi</pre>
<pre>}</pre>
<pre>status(){</pre>
<pre>pid=`pidof`</pre>
<pre>if [ "$pid" != "" ] ; then</pre>
<pre>echo "postgres is running"</pre>
<pre>echo `ps -ef | grep postgres | grep -v grep | awk '{if ($3==1) print "Postgres: " $8 ", Data Directory: " $10}'`</pre>
<pre>else</pre>
<pre>echo "postgres is not running"</pre>
<pre>fi</pre>
<pre>}</pre>
<pre>vac_status(){</pre>
<pre>su - postgres -c "${PGBIN}/psql -c \"select relname, last_autovacuum, last_autoanalyze from pg_stat_user_tables where last_autovacuum IS NOT NULL order by last_autovacuum desc\""</pre>
<pre>}</pre>
<pre>show_connections(){</pre>
<pre>su - postgres -c "${PGBIN}/psql -c \"SELECT datname, usename, procpid, client_addr, waiting, query_start, current_query FROM pg_stat_activity;\""</pre>
<pre>}</pre>
<pre>version(){</pre>
<pre>su - postgres -c "${PGBIN}/psql -c \"SELECT version()\""</pre>
<pre>}</pre>
<pre>restore_bak(){</pre>
<pre>echo "backup file path : "</pre>
<pre>read BACKUPFILEPATH</pre>
<pre>echo "database name : "</pre>
<pre>read DBNMAE</pre>
<pre>chmod -R 777 $BACKUPFILEPATH</pre>
<pre>cat ${BACKUPFILEPATH} | gunzip | ${PGBIN}/psql -U postgres ${DBNMAE}</pre>
<pre>${PGBIN}/psql -d ${DBNMAE} -U postgres &lt; /users.sql</pre>
<pre>}</pre>
<pre>case "$1" in</pre>
<pre>start)</pre>
<pre>start</pre>
<pre>;;</pre>
<pre>stop)</pre>
<pre>stop</pre>
<pre>;;</pre>
<pre>status)</pre>
<pre>status</pre>
<pre>;;</pre>
<pre>restart)</pre>
<pre>stop</pre>
<pre>start</pre>
<pre>;;</pre>
<pre>stopfast)</pre>
<pre>stopfast</pre>
<pre>;;</pre>
<pre>stopnow)</pre>
<pre>stopnow</pre>
<pre>;;</pre>
<pre>vac_status)</pre>
<pre>vac_status</pre>
<pre>;;</pre>
<pre>show_connections)</pre>
<pre>show_connections</pre>
<pre>;;</pre>
<pre>restore_bak)</pre>
<pre>restore_bak</pre>
<pre>;;</pre>
<pre>version)</pre>
<pre>version</pre>
<pre>;;</pre>
<pre>*)</pre>
<pre>echo "Usage: $0 { start | stop | restart | stopfast | stopnow | status | vac_status | show_connections | version | restore_bak }"</pre>
<pre>exit 1</pre>
<pre>esac</pre>
<pre>exit 0</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2012/01/postgresql-utility-for-enterprisedb-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL DB Version Control with apgdiff</title>
		<link>http://anypossibility.com/blog/2012/01/postgresql-db-version-control-with-apgdiff/</link>
		<comments>http://anypossibility.com/blog/2012/01/postgresql-db-version-control-with-apgdiff/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 04:05:41 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=378</guid>
		<description><![CDATA[apgdiff (Another PostgreSQL Diff Tool) is so easy to setup and use. # you need at least Java 1.6 $ java -version java version &#8220;1.6.0_29&#8243; Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527) Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode) # download binary and that&#8217;s it. $ curl -O http://apgdiff.startnet.biz/download/apgdiff-2.3-bin.zip $ unzip apgdiff-2.3-bin.zip # create [...]]]></description>
			<content:encoded><![CDATA[<p><a title="apgdiff" href="http://apgdiff.startnet.biz/">apgdiff </a>(Another PostgreSQL Diff Tool) is so easy to setup and use.</p>
<p># you need at least Java 1.6</p>
<blockquote><p>$ java -version</p>
<p>java version &#8220;1.6.0_29&#8243;<br />
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527)<br />
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)</p></blockquote>
<p># download binary and that&#8217;s it.</p>
<blockquote><p>$ curl -O http://apgdiff.startnet.biz/download/apgdiff-2.3-bin.zip<br />
$ unzip apgdiff-2.3-bin.zip</p></blockquote>
<p># create SQL dump files</p>
<blockquote><p>$ pg_dump &#8211;host HOST_IP &#8211;port 5432 -U DB_USER -s -f new.sql ALPHA_DB<br />
$ pg_dump &#8211;host HOST_IP &#8211;port 5432 -U USER -s -f old.sql PROD_DB</p></blockquote>
<p># generate upgrade statement</p>
<blockquote><p>$ PATH_TO_APGDIFF=/tmp/apgdiff<br />
$ java -jar $PATH_TO_APGDIFF/apgdiff-2.3.jar &#8211;ignore-start-with old.sql new.sql &gt; upgrade.sql</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2012/01/postgresql-db-version-control-with-apgdiff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL &#8211; Document PostgreSQL functions</title>
		<link>http://anypossibility.com/blog/2012/01/document-postgresql-functions/</link>
		<comments>http://anypossibility.com/blog/2012/01/document-postgresql-functions/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 19:25:46 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=338</guid>
		<description><![CDATA[Yep, documentation is critical. Everyone knows that Search-ability of the documentation is critical as documentation. We started to document postgreSQL trigger/functions and created view to list function name, definition and comments etc&#8230; It is pretty handy and would like to share this with you. &#8211; Add Comments COMMENT ON FUNCTION my_function(text) IS &#8216;function description&#8217;; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Yep, documentation is critical. Everyone knows that <img src='http://anypossibility.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Search-ability of the documentation is critical as documentation.</p>
<p>We started to document postgreSQL trigger/functions and created view to list function name, definition and comments etc&#8230; It is pretty handy and would like to share this with you.</p>
<p>&#8211; Add Comments</p>
<blockquote><p>COMMENT ON FUNCTION my_function(text) IS &#8216;function description&#8217;;</p></blockquote>
<p>&nbsp;</p>
<p>&#8211; Search by Comments</p>
<blockquote><p>SELECT * from pg_catalog.pg_description WHERE description = &#8216;function description&#8217;; &#8212; Search for Specific description</p></blockquote>
<p>&nbsp;</p>
<p>&#8211; List All Functions along with Comments</p>
<blockquote><p>SELECT p.proname<br />
,p.proargnames<br />
,obj_description(p.oid)<br />
,pg_get_functiondef(p.oid)<br />
,CASE WHEN p.prorettype=2279 THEN &#8216;Trigger Function&#8217; ELSE &#8216;Function&#8217; END as type<br />
FROM pg_proc p<br />
JOIN pg_namespace nspance ON nspance.oid = p.pronamespace<br />
WHERE<br />
nspname=&#8217;public&#8217; AND proowner &lt;&gt; 10<br />
&#8211; AND proname = &#8216;my_function&#8217; &#8212; Search for Specific function<br />
&#8211; AND p.prorettype=2279 &#8212; Triggere Function Only<br />
ORDER BY 5, 1</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2012/01/document-postgresql-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL &#8211; Document Table and Column Description (Comments on Table and Column)</title>
		<link>http://anypossibility.com/blog/2011/08/postgresql-document-table-and-column-description-comments-on-table-and-column/</link>
		<comments>http://anypossibility.com/blog/2011/08/postgresql-document-table-and-column-description-comments-on-table-and-column/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 04:08:27 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=303</guid>
		<description><![CDATA[&#8211; Add comment to table COMMENT ON TABLE fnl is &#8216;Customer Information&#8217; &#8211; Add comment to column COMMENT ON COLUMN customer.id is &#8216;customer primary key&#8217; &#160; &#8211; Retrieve Info Individually SELECT col_description((select c.oid from pg_catalog.pg_class c where c.relname = &#8216;customer&#8217;), 1) SELECT obj_description((select c.oid from pg_catalog.pg_class c where c.relname = &#8216;customer&#8217;)) &#160; &#8211; Retrieve Info [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>&#8211; Add comment to table</p>
<p>COMMENT ON TABLE fnl is &#8216;Customer Information&#8217;</p>
<p>&#8211; Add comment to column</p>
<p>COMMENT ON COLUMN customer.id is &#8216;customer primary key&#8217;</p>
<p>&nbsp;</p>
<p>&#8211; Retrieve Info Individually</p>
<p>SELECT col_description((select c.oid from pg_catalog.pg_class c where c.relname = &#8216;customer&#8217;), 1)</p>
<p>SELECT obj_description((select c.oid from pg_catalog.pg_class c where c.relname = &#8216;customer&#8217;))</p>
<p>&nbsp;</p>
<p>&#8211; Retrieve Info for one table</p>
<p>SELECT</p>
<p>cols.column_name</p>
<p>,(select pg_catalog.obj_description(oid) from pg_catalog.pg_class c where c.relname=cols.table_name) as table_comment</p>
<p>,(select pg_catalog.col_description(oid,cols.ordinal_position::int) from pg_catalog.pg_class c where c.relname=cols.table_name) as column_comment</p>
<p>FROM information_schema.columns cols</p>
<p>WHERE cols.table_catalog=&#8217;database_name&#8217; and cols.table_name=&#8217;customer&#8217;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2011/08/postgresql-document-table-and-column-description-comments-on-table-and-column/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>postgreSQL &#8211; inconsistent performance</title>
		<link>http://anypossibility.com/blog/2011/08/postgresql-inconsistent-performance/</link>
		<comments>http://anypossibility.com/blog/2011/08/postgresql-inconsistent-performance/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 03:55:53 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=297</guid>
		<description><![CDATA[We have this query to join 4 tables. For some reason, the performance of this query was inconsistent on Server A. First run took 6 sec, 2nd run took 300 ms then 3rd run took 6 sec again etc&#8230; We dump the data to other server and run the same query, very consistent result &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>We have this query to join 4 tables.</p>
<p>For some reason, the performance of this query was inconsistent on Server A. First run took 6 sec, 2nd run took 300 ms then 3rd run took 6 sec again etc&#8230;</p>
<p>We dump the data to other server and run the same query, very consistent result &#8211; about 100 ms almost all the time.</p>
<p>We even got &#8220;<em>could not read from hash-join temporary file</em>&#8221; error and crashed Server A. We end up finding out that work_mem of the Server A is set to very low compare to other servers.</p>
<p>So followed this: http://wiki.postgresql.org/wiki/Performance_Optimization and we changed 2 settings:</p>
<p>work_mem to 16MB &#8211; default is 1MB and it was the default value</p>
<p>effective_cache_size &#8211; this one was also default of 128MB&#8230; so I set it to 3GB (machie has 6 GB and according to the wiki, half of the size of RAM would be good)</p>
<p>Then restart the server and yes, the performance was so consistent and was producing the same result as other server.</p>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2011/08/postgresql-inconsistent-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL: Dump Schema Only or Triggers Only</title>
		<link>http://anypossibility.com/blog/2010/07/postgresql-dump-schema-only-or-triggers-only/</link>
		<comments>http://anypossibility.com/blog/2010/07/postgresql-dump-schema-only-or-triggers-only/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 21:59:46 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=84</guid>
		<description><![CDATA[I needed to extract triggers only, sequence/index only etc when we migrated database. I received advice from postgresql General List and thought I should post exact step/script of how to accomplish this. Open Terminal: 1. dump schema only pg_dump -h localhost -p 5432 &#8211;username UserName &#8211;schema-only &#8211;format c &#8211;file path_to_backup.backup &#8211;schema &#8216;public&#8217; db_name 2. create [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to extract triggers only, sequence/index only etc when we migrated database.<br />
I received advice from postgresql General List and thought I should post exact step/script of how to accomplish this.</p>
<p>Open Terminal:</p>
<p>1. dump schema only</p>
<blockquote><p>pg_dump -h localhost -p 5432 &#8211;username UserName &#8211;schema-only &#8211;format c &#8211;file path_to_backup.backup &#8211;schema &#8216;public&#8217; db_name</p></blockquote>
<p>2. create list of item that you want to extract<br />
2.1. TRIGGERS only</p>
<blockquote><p>pg_restore &#8211;list &#8220;path_to_backup.backup&#8221; | awk &#8216;/[0-9]*; [0-9]* [0-9]* (TRIGGER)/ { print }&#8217; &gt; &#8220;path_to_triggers.list&#8221;</p></blockquote>
<p>2.2. SEQUENCE, INDEX</p>
<blockquote><p>pg_restore &#8211;list &#8220;path_to_backup.backup&#8221; | awk &#8216;/[0-9]*; [0-9]* [0-9]* (SEQUENCE|INDEX)/ { print }&#8217; &gt; &#8220;path_to_seq.list&#8221;</p></blockquote>
<p>3. Create SQL script from the list<br />
3.1. TRIGGERS only</p>
<blockquote><p>pg_restore  -L path_to_triggers.list -f dest_path_triggers.sql path_to_backup.backup</p></blockquote>
<p>3.2. SEQUENCE, INDEX</p>
<blockquote><p>pg_restore  -L path_to_seq.list -f dest_path_seq.sql path_to_backup.backup</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/07/postgresql-dump-schema-only-or-triggers-only/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nightly backup (pg_dump) with shell script and cron job</title>
		<link>http://anypossibility.com/blog/2010/07/nightly-backup-pg_dump-with-shell-script-and-cron-job/</link>
		<comments>http://anypossibility.com/blog/2010/07/nightly-backup-pg_dump-with-shell-script-and-cron-job/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 15:00:05 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=41</guid>
		<description><![CDATA[1. write a shell script #!/bin/bash #backup.sh logfile=&#8221;/backups/logfile.log&#8221; # Location to place backups. backup_dir=&#8221;/backups&#8221; touch $logfile timeslot=`date +%y%m%d_%H%M` databases=(&#8220;db1&#8243; &#8220;db2&#8243; &#8220;db3&#8243;) # get length of an array tLen=${#databases[@]} for (( i=0; i&#60;${tLen}; i++ )); do echo &#8220;Vacuum Starting at `date` for database: ${databases[$i]} &#8221; &#62;&#62; $logfile timeinfo=`date &#8216;+%T %x&#8217;` psql -c &#8220;vacuum verbose analyze&#8221; -d [...]]]></description>
			<content:encoded><![CDATA[<p>1. write a shell script</p>
<blockquote>
<div id="_mcePaste">#!/bin/bash</div>
<div>#backup.sh</div>
<div id="_mcePaste">logfile=&#8221;/backups/logfile.log&#8221;</div>
<div id="_mcePaste"># Location to place backups.</div>
<div id="_mcePaste">backup_dir=&#8221;/backups&#8221;</div>
<div id="_mcePaste">touch $logfile</div>
<div id="_mcePaste">timeslot=`date +%y%m%d_%H%M`</div>
<div id="_mcePaste">databases=(&#8220;db1&#8243; &#8220;db2&#8243; &#8220;db3&#8243;)</div>
<div id="_mcePaste"># get length of an array</div>
<div id="_mcePaste">tLen=${#databases[@]}</div>
<div id="_mcePaste">for (( i=0; i&lt;${tLen}; i++ )); do</div>
<div id="_mcePaste">echo &#8220;Vacuum Starting at `date` for database: ${databases[$i]} &#8221; &gt;&gt; $logfile</div>
<div id="_mcePaste">timeinfo=`date &#8216;+%T %x&#8217;`</div>
<div id="_mcePaste">psql -c &#8220;vacuum verbose analyze&#8221; -d ${databases[$i]} -U postgres &gt;&gt; $logfile</div>
<div id="_mcePaste">echo &#8220;Vacuum completed. Backup Starting at `date` for database: ${databases[$i]} &#8221; &gt;&gt; $logfile</div>
<div id="_mcePaste">pg_dump ${databases[$i]} -h 127.0.0.1  -U postgres | gzip &gt; &#8220;$backup_dir/${databases[$i]}-$timeslot-backup.gz&#8221;</div>
<div id="_mcePaste">echo &#8220;Backup and Vacuum complete at `date` for database: ${databases[$i]} &#8221; &gt;&gt; $logfile</div>
<div id="_mcePaste">done</div>
</blockquote>
<p>2. Add an entry to crontab to execute the script above<br />
2.1. open terminal and login as postgres: $ su &#8211; postgres<br />
2.2. list cron job: $ crontab -l<br />
2.3. edit cron job:<br />
2.3.1. $ crontab -e #in terminal vi editor will open)<br />
2.3.2. i for insert mode<br />
2.3.3. enter entry. for instance, to run it every 1 am:<br />
<blockquote>00 01 * * * path_to_backup.sh &gt; /dev/null </p></blockquote>
<p>2&gt;&amp;1<br />
2.3.4. ESC key to exist edit mode<br />
2.3.5. :wq to save and quit</p>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/07/nightly-backup-pg_dump-with-shell-script-and-cron-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

