<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-6356223856264576429</atom:id><lastBuildDate>Wed, 18 Jul 2012 13:47:04 +0000</lastBuildDate><category>sessions</category><category>postgresql</category><category>postgres</category><category>proactive database monitoring</category><category>security</category><category>tracking</category><category>tuning</category><category>performance</category><category>newfeature</category><category>bloat</category><category>solaris</category><category>listener</category><category>mvcc</category><category>smf</category><category>database</category><category>oracle</category><category>pgwest2010</category><category>blocking</category><title>Denish Patel</title><description /><link>http://denishjpatel.blogspot.com/</link><managingEditor>noreply@blogger.com (Denish Patel)</managingEditor><generator>Blogger</generator><openSearch:totalResults>33</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/DenishPatel" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="denishpatel" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-755531439466572015</guid><pubDate>Mon, 02 Apr 2012 22:57:00 +0000</pubDate><atom:updated>2012-04-02T19:00:28.270-04:00</atom:updated><title>Deploying Maximum HA Architecture with PostgreSQL</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Today, I gave talk on "Deploying Maximum HA Architecture with PostgreSLQ" at &lt;a href="http://pgday.nycpug.org/schedule/"&gt;PG Day New York&lt;/a&gt;. You could check out slides here !&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: left; width: 425px;"&gt;&lt;object height="355" style="margin: 0px;" width="425"&gt;&lt;param name='movie' value='http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=deployingmaximumhaarchitecturewithpostgresql-13334016362821-phpapp02-120402163920-phpapp02&amp;stripped_title=deploying-maximum-ha-architecture-with-postgresql-12261838' /&gt;&lt;param name='allowFullScreen' value='true'/&gt;&lt;param name='allowScriptAccess' value='always'/&gt;&lt;embed src='http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=deployingmaximumhaarchitecturewithpostgresql-13334016362821-phpapp02-120402163920-phpapp02&amp;stripped_title=deploying-maximum-ha-architecture-with-postgresql-12261838' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='425' height='355'&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2012/04/deploying-maximum-ha-architecture-with.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-4444454627994053283</guid><pubDate>Mon, 26 Mar 2012 12:12:00 +0000</pubDate><atom:updated>2012-03-26T08:13:40.670-04:00</atom:updated><title>2 PG Days in 2 days apart !!</title><description>Want to learn more about PostgreSQL? Are you at driving distance from Washington DC and/or Newyork area? If any of anwers is yes then you shound't miss this opportunity to attend 2 PostgreSQL Days within 2 days apart in your area with plenty of knowledge sharing talks and networking events!&lt;br /&gt;
&lt;br /&gt;
1. Friday,March 30th,2012 &lt;a href="http://pgday.bwpug.org/schedule"&gt;PG Day in Washington DC &lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
2. Monday,April 2nd,2012 &lt;a href="http://pgday.nycpug.org/schedule/"&gt;PG day in Newyork &lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I will be attending both of the these days. If you are attending, will love to meet you in-person. &lt;br /&gt;
&lt;br /&gt;
See you soon!!</description><link>http://denishjpatel.blogspot.com/2012/03/2-pg-days-in-2-days-apart.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-2668393161889188934</guid><pubDate>Thu, 01 Mar 2012 21:06:00 +0000</pubDate><atom:updated>2012-03-01T16:07:08.298-05:00</atom:updated><title>monitor bucardo replication lag using circonus</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I have been using &lt;a href="https://circonus.com/"&gt;circonus&lt;/a&gt; for monitoring, trending and alerting for any database metrics for quite a long time now. The circonus interface makes the monitoring, trending and alerting setup painless and you can see graph flowing in minutes. Another good thing about Circonus is that you can monitor anything that you can query from database ! This week, the task at my hand was to find a way to monitor bucardo replication lag. &amp;nbsp;`&lt;a href="http://bucardo.org/wiki/Bucardo_ctl"&gt;bucardo_ctl status &lt;/a&gt;sync_name` provides very important information that you can rely for trending and alerting purposes.&lt;br /&gt;
&lt;samp&gt;&lt;br /&gt;
$ bucardo_ctl status my_slave&lt;br /&gt;
Sync name:            my_sync&lt;br /&gt;
Current state:        WAIT:22s (PID = 19500)&lt;br /&gt;
Type:                 pushdelta&lt;br /&gt;
Source herd/database: slave_herd / master_herd&lt;br /&gt;
Target database:      my_slave&lt;br /&gt;
Tables in sync:       318&lt;br /&gt;
Last good:            23s (time to run: 1m 21s)&lt;br /&gt;
Last good time:       Feb 29, 2012 15:27:14  Target: my_slave&lt;br /&gt;
Ins/Upd/Del:          142 / 0 / 0&lt;br /&gt;
Last bad:             1h 45m 9s (time to run: 19m 57s)&lt;br /&gt;
Last bad time:        Feb 29, 2012 13:42:29  Target: my_slave&lt;br /&gt;
Latest bad reason: MCP removing stale q entry&lt;br /&gt;
PID file:             /var/run/bucardo/bucardo.ctl.sync.my_sync.pid&lt;br /&gt;
PID file created:     Wed Feb 29 13:42:33 2012&lt;br /&gt;
Status:               active&lt;br /&gt;
Limitdbs:             0&lt;br /&gt;
Priority:             0&lt;br /&gt;
Checktime:            none&lt;br /&gt;
Overdue time:         00:00:00&lt;br /&gt;
Expired time:         00:00:00&lt;br /&gt;
Stayalive:            yes      Kidsalive: yes&lt;br /&gt;
Rebuild index:        0        Do_listen: no &lt;br /&gt;
Ping:                 yes      Makedelta: no &lt;br /&gt;
Onetimecopy:          0&lt;br /&gt;
&lt;/samp&gt;&lt;br /&gt;
&lt;br /&gt;
All the information provided by `bucardo_ctl status` command is important but most interesting thing to monitor is "Last good:". Last good shows bucardo replication lag on slave server.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Trending in circonus&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
Now, I have metric identified for the monitoring. Next step is to find the best way to put the metric into the monitoring tool. After some poking around the output and ways to monitor stuff, I decided to grab the SQL query from bucardo_ctl perl script and stick it into circonus monitoring. Most of the time spent for setting up this monitor was to grab right query from big perl script (bucardo_ctl) and mapping the metric required from the query. After that, here is the query that I plugged &amp;nbsp;into Circonus in no-time.&lt;br /&gt;
&lt;br /&gt;
&lt;samp&gt; SELECT &lt;br /&gt;
'bucardo_last_good' , round(extract(epoch FROM now()-ended)) &lt;br /&gt;
FROM&lt;br /&gt;
(SELECT * FROM bucardo.q WHERE sync = 'my_sync' AND cdate &amp;gt;= now() - interval '3 days'&lt;br /&gt;
UNION ALL&lt;br /&gt;
SELECT * FROM freezer.master_q &lt;br /&gt;
WHERE sync = 'my_sync' AND cdate &amp;gt;= now() - interval '3 days') AS foo&lt;br /&gt;
WHERE ended is NOT NULL AND aborted IS NULL&lt;br /&gt;
ORDER BY ended DESC LIMIT 1;&lt;br /&gt;
&lt;/samp&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-h2wo699i03c/T0_ba8PbmMI/AAAAAAAAIH4/Wcq3CxJR2-s/s1600/Screen%2BShot%2B2012-03-01%2Bat%2B3.23.54%2BPM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="344" src="http://4.bp.blogspot.com/-h2wo699i03c/T0_ba8PbmMI/AAAAAAAAIH4/Wcq3CxJR2-s/s640/Screen%2BShot%2B2012-03-01%2Bat%2B3.23.54%2BPM.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;Alerting in circonus:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
bucardo_ctl status shows Last good status to "unknown" if replication is broken.&lt;br /&gt;
&lt;samp&gt;&lt;br /&gt;
Name     Type  State PID     Last_good Time  I/U/D Last_bad Time &lt;br /&gt;
===========+=====+========+====+=========+=====+=====+========+=====&lt;br /&gt;
my_sync| P   |WAIT:35s|7620| unknown  |     |     |36s     |1m58s&lt;br /&gt;
&lt;/samp&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;In circonus, you could setup rules and relevant severity levels. The most important part is that if the query doesn't return any row it should page("unknown" condition) . Circonus provides rule for alerts in case of a metric is absent. Now, I am all set with alerts as well.&lt;br /&gt;
&lt;br /&gt;
Yay! bucardo replication is under monitoring and trending without any hassle!&amp;nbsp;Hopefully, this post will help you next time when you try to put bucardo replication lag under monitoring.&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2012/03/monitor-bucardo-replication-lag-using.html</link><author>noreply@blogger.com (Denish Patel)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-h2wo699i03c/T0_ba8PbmMI/AAAAAAAAIH4/Wcq3CxJR2-s/s72-c/Screen%2BShot%2B2012-03-01%2Bat%2B3.23.54%2BPM.png" height="72" width="72" /><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-5131562505854785670</guid><pubDate>Tue, 14 Feb 2012 16:46:00 +0000</pubDate><atom:updated>2012-02-14T11:46:08.780-05:00</atom:updated><title>Half a decade with OmniTi, PostgreSQL, FOSS ...</title><description>By end of this month, I am completing 5 years with &lt;a href="http://omniti.com/is"&gt;OmniTI&lt;/a&gt;. Before joining OmniTI, I was an Oracle DBA and worked mostly with closed source databases. I am grateful &amp; fortunate that &lt;a href="http://omniti.com/is/theo-schlossnagle"&gt;Theo&lt;/a&gt; and &lt;a href="http://www.xzilla.net/"&gt;Robert&lt;/a&gt; provided me opportunity and guidance to work and contribute with open source technologies and most importantly an open source database &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; ! At OmniTI, if you don't have hesitation to learn new technlogy, you will have smooth learning experience alongside working with your known technology for the clients. Most importantly, you can have access to technology leaders in the office. Ironically, I never worked for single company longer than a year before joining OmniTI in my career but now I am looking forward to learn and contribute to FOSS community working with OmniTI. &lt;br /&gt;
&lt;br /&gt;
Since joining, I haven't spent a day without learning a new thing . Are you bored at routine work?  &lt;a href="http://omniti.com/is/hiring/database-administrator"&gt;Come join OmniTI's adventure&lt;/a&gt;, here I work!&lt;br /&gt;
&lt;br /&gt;
Bravo to OmniTI &amp; PosgreSQL and FOSS community!!</description><link>http://denishjpatel.blogspot.com/2012/02/half-decade-with-omniti-postgresql-foss.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-648562429227133913</guid><pubDate>Thu, 05 Jan 2012 23:03:00 +0000</pubDate><atom:updated>2012-01-05T18:03:52.136-05:00</atom:updated><title>What is pg_extractor ?</title><description>In my recent blog post, I wrote about &lt;a href="http://denishjpatel.blogspot.com/2011/11/postgresql-handyman-toolset.html"&gt;PostgreSQL DBA Handyman toolset&lt;/a&gt;. In the list of tools, getddl is one of them. If you are using &lt;a href="https://labs.omniti.com/pgtreats/trunk/getddl/README"&gt;getddl&lt;/a&gt; to get DDL schema and track the daily changes in SVN for production databases, you should consider moving that process to use pg_extractor instead. &lt;a href="https://github.com/omniti-labs/pg_extractor"&gt;pg_extractor&lt;/a&gt; is the more advance and robust tool for extracting schema as well data using pg_dump. &lt;a href="http://omniti.com/is/keith-fiske"&gt;Keith Fiske&lt;/a&gt;, an author of the tool, described tool in detail in &lt;a href="http://keithf4.com/pg_extractor"&gt;his blog post&lt;/a&gt;. Thanks to Keith for making the schema extraction tool more robust and taking it to next level !&lt;br /&gt;
&lt;br /&gt;
Hopefully, it will help you to have more control over your database in smarter way!</description><link>http://denishjpatel.blogspot.com/2012/01/what-is-pgextractor.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-5686316937428265085</guid><pubDate>Tue, 06 Dec 2011 17:02:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.914-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>Faster &amp; Better VACUUM FULL</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In &lt;a href="http://denishjpatel.blogspot.com/2011/03/p90x-your-database-presentation-slides.html"&gt;presentation&lt;/a&gt;, I discussed in detail about Bloat issue in PostgreSQL and methods to remove Bloat from the tables/indexes. Now a days, PostgreSQL9.0 is common and&amp;nbsp; the widely used version for the production use and it's vital to remind about changes in most important bloat removal tool called "VACUUM FULL". Until PostgreSQL 9.0, VACUUM FULL was tardy and DBA always stayed away from it and used CLUSTER instead. (Checkout &lt;a href="http://denishjpatel.blogspot.com/2011/03/p90x-your-database-presentation-slides.html"&gt;presentation&lt;/a&gt; for difference between CLUSTER vs VACUUM FULL) &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The VACUUM FULL statement recovers free  space from a table to reduce its size from bloated tables, mostly when VACUUM itself hasn't  been run frequently enough. Before PostgreSQL 9.0 , it was tardy and slow because of the way it was executed: records were read and  moved one by one from their source block to a block closer to the  beginning of the table. Once the end of the table was emptied, this  empty part was removed. This method was very inefficient: moving records one by one  creates a lot of random IO.&amp;nbsp; Additionally, during this reorganization,  indexes had to be maintained, making everything even more costly, and  fragmenting indexes. It was therefore advised to reindex a table just  after a VACUUM FULL. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Now, the VACUUM FULL statement, as of PostgreSQL 9.0, creates a new table  from the current one, copying all the records sequentially. Once all  records are copied, index are created back, and the old table is  destroyed and replaced. This has the advantage of being much faster. VACUUM FULL still  needs an &lt;b&gt;EXCLUSIVE LOCK&lt;/b&gt;&amp;nbsp; during entire operation. The only drawback of  this method compared to the old one, is that VACUUM FULL can use as much  as two times the size of the table and indexes on disk, as it is creating a new  versions of it.&lt;br /&gt;
&lt;br /&gt;
Let's compare run-time of VACUUM FULL on PostgreSQL 8.4 vs PostgreSQL 9.0 &lt;br /&gt;
&lt;br /&gt;
&lt;samp&gt;postgres=# create table vacuumtest(id int primary key);&lt;br /&gt;
NOTICE:&amp;nbsp; CREATE TABLE / PRIMARY KEY will create implicit index "vacuumtest_pkey" for table "vacuumtest"&lt;br /&gt;
CREATE TABLE&lt;br /&gt;
postgres=# insert into vacuumtest select generate_series(1,10000000);&lt;br /&gt;
INSERT 0 10000000&lt;br /&gt;
postgres=# delete from vacuumtest where id%4=0;&lt;br /&gt;
DELETE 2500000&lt;br /&gt;
postgres=# vacuum vacuumtest;&lt;br /&gt;
VACUUM&lt;br /&gt;
&lt;/samp&gt;&lt;br /&gt;
On 8.4:&lt;br /&gt;
&lt;samp&gt; postgres=# vacuum full vacuumtest ;&lt;br /&gt;
VACUUM&lt;br /&gt;
Time: 61418.197 ms&lt;br /&gt;
postgres=# reindex table vacuumtest;&lt;br /&gt;
REINDEX&lt;br /&gt;
Time: 12212.815 ms&lt;br /&gt;
&lt;/samp&gt;&lt;br /&gt;
&lt;br /&gt;
On 9.0:&lt;br /&gt;
&lt;samp&gt; postgres=# vacuum full vacuumtest ;&lt;br /&gt;
VACUUM&lt;br /&gt;
Time: 32640.714 ms&lt;br /&gt;
&lt;/samp&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Above results show that VACCUM FULL on PostgreSQL 9.0 is way faster than previous versions. Moreover, VACUUM FULL has couple of advantages over CLUSTER :&amp;nbsp; it's faster than CLUSTER because it doesn't have to build new table using ORDER by clause &amp;amp; you can run VACUUM FULL on tables on which there isn't any index.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you are running any bloat removal tool on the production database, i would recommend you to revisit vacuum parameters and tighten them up a little that makes regular vacuum to run more frequent so it will help to reduce frequency of running more intrusive &lt;a href="http://denishjpatel.blogspot.com/2011/03/p90x-your-database-presentation-slides.html"&gt;bloat removal tools&lt;/a&gt;!!&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2011/12/faster-better-vaccum-full.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-3663247720734355237</guid><pubDate>Fri, 11 Nov 2011 20:20:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.915-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>PostgreSQL Handyman Toolset</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A &lt;b&gt;PostgreSQL handyman&lt;/b&gt; is a person skilled at a wide range of maintenance and repairs, typically around the PostgreSQL database system.&amp;nbsp; If you are working with PostgreSQL and you have right tools for&amp;nbsp; the job, you can easily accomplish that job efficiently and most importantly on time. In real world, if you want to dig into land and you don't have tools then you are failed at job before you start the job!&amp;nbsp; Having tools for any job is most important factor for job success. While working at &lt;a href="http://omniti.com/does/data-management"&gt;OmniTI&lt;/a&gt;, I tested and used variety of tools to make my work life easy and efficient. &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PostgreSQL community is thriving by people, those helps to build new  tools, give it back to community for re-use and providing helping hands  to test the tools. Here are &lt;i&gt;&lt;b&gt;some&lt;/b&gt;&lt;/i&gt; of my suggested list of tools which could help&amp;nbsp; to finish your job efficiently and on time!! &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;1.&amp;nbsp;&lt;a href="http://labs.omniti.com/labs/pgtreats/browser/trunk"&gt; Tasty Treats for PostgreSQL&lt;/a&gt; project includes plenty of PostgreSQL management tools , which is one of the projects of&lt;a href="http://labs.omniti.com/"&gt; OmniTI's Lab&lt;/a&gt; repository.&lt;br /&gt;
&lt;br /&gt;
Some of the tools includes: &lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;li&gt;zbackup&lt;/li&gt;
&lt;li&gt;getddl&lt;/li&gt;
&lt;li&gt;pgsniff&lt;/li&gt;
&lt;li&gt;table growth report&lt;/li&gt;
&lt;li&gt;quickstats&lt;/li&gt;
&lt;li&gt;pg_log monitor &lt;/li&gt;
&lt;li&gt;bloat reports&lt;/li&gt;
&lt;li&gt;pgtruss&lt;/li&gt;
&lt;li&gt;system monitoring&lt;/li&gt;
&lt;li&gt;compact table&lt;/li&gt;
&lt;li&gt;blocked queries&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/omniti-labs/curo"&gt;Curo&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
2.&amp;nbsp; &lt;a href="https://github.com/omniti-labs/omnipitr"&gt;OMNIpitr&lt;/a&gt; Advanced WAL File Management Tools for PostgreSQL. This tool helps to handle HA processes efficiently to manage wal shipping, restore &amp;amp; removal , &lt;b&gt;online backup on slave&lt;/b&gt; and/or master.&lt;br /&gt;
&lt;br /&gt;
3.&amp;nbsp;&lt;a href="http://bucardo.org/"&gt; bucardo.org&lt;/a&gt; also includes mission critial tools:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;li&gt;&amp;nbsp;Bucardo&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;Asynchronous PostgreSQL Replication System&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;check_postgres&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;Nagios-Friendly PostgreSQL Database Checking Script&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;pgsi&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;Wiki-Ready Query Reports&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;tail_n_mail&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;Monitor log files&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;boxinfo&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;Gather system information&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;&lt;br /&gt;
4.&amp;nbsp; &lt;a href="https://github.com/greg2ndQuadrant/repmgr"&gt;repmgr&lt;/a&gt;: it allows you to monitor and manage&amp;nbsp; high availability part of&amp;nbsp; PostgreSQL databases (9.0+) installation.&lt;br /&gt;
&lt;br /&gt;
5. &lt;a href="http://reorg.projects.postgresql.org/pg_reorg.html"&gt;pg_reorg&lt;/a&gt;: it allows you to rebuild Bloated tables online. Review &lt;a href="http://denishjpatel.blogspot.com/2011/03/p90x-your-database-presentation-slides.html"&gt;these slides&lt;/a&gt; to understand how it works.&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
6.&amp;nbsp; &lt;a href="http://www.rubyrep.org/features.html"&gt;RubyRep &lt;/a&gt;: Components of this tool set can help you &lt;a href="http://denishjpatel.blogspot.com/2009/08/yet-another-postgresql-replication-tool.html"&gt;compare and sync&lt;/a&gt; two tables or even two databases.&lt;br /&gt;
&lt;br /&gt;
I would love to know&amp;nbsp; tools used by you for managing PostgreSQL database server which are missing from my PostgreSQL handyman too-lset !!&lt;br /&gt;
&lt;br /&gt;
Hopefully, these tools will make your next task easy!! If you find bug, don't hesitate to report to send out email to relevant tool maintainer with error or suggestion or patch with bug fix. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DISCLAIMER: use any of listed tool on production at your own risk.&lt;br /&gt;
&lt;div class="repository-description" id="repository_description"&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2011/11/postgresql-handyman-toolset.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-2545755629449094265</guid><pubDate>Wed, 14 Sep 2011 19:39:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.915-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>The Scalability &amp; Performance Conference : Surge 2011</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; The Scalability and Performance covers most of the web scale issues, innovations and &amp;nbsp;evolutions in technology. As per my knowledge, &lt;a href="http://omniti.com/surge/2011"&gt;Surge&lt;/a&gt;&amp;nbsp;is the only conference &amp;nbsp;that gives the coverage to the issues and solutions concerning Scalability &amp;amp; Performance without any bias on technology that we often notice at most other conferences. For example , if you are looking from Database perspective, it covers topic ranges from RDBMS to NoSQL and talks about problems solved by the technology and new possible problems introduced by new technology.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;I attended &lt;a href="http://omniti.com/surge/2011"&gt;Surge&lt;/a&gt;&amp;nbsp;2010 and listed attended sessions on my&amp;nbsp;&lt;a href="http://denishjpatel.blogspot.com/2010/08/outlining-surge-conference-sessions.html"&gt;last year&lt;/a&gt;&amp;nbsp;&amp;nbsp;post. I am going to attend&amp;nbsp;&lt;a href="http://omniti.com/surge/2011"&gt;Surge&lt;/a&gt;&amp;nbsp;again. Surge 2010 was the best conference attendance experience for me and &lt;a href="http://rhaas.blogspot.com/2010/10/surge-recap.html"&gt;others&lt;/a&gt;. By looking at &lt;a href="http://omniti.com/surge/2011"&gt;Sponsor list &lt;/a&gt;&amp;nbsp;(Google is one of them!), this year (Sept 28-30 , 2011) conference&amp;nbsp;is going to be far bigger and better than last year &amp;nbsp;and don't forget to checkout industry leader &lt;a href="http://omniti.com/surge/2011/speakers"&gt;Speakers&lt;/a&gt; list &amp;amp; Hack Day/&lt;a href="http://omniti.com/surge/2011/sessions/training"&gt;Training&lt;/a&gt; Schedule !! &amp;nbsp;If you haven't registered , you still have chance to do so. &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://omniti.com/surge/2011"&gt;Surge 2011&lt;/a&gt; will be surge of the knowledge ! See you soon !&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2011/09/scalability-performance-conference.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-2824224531310232594</guid><pubDate>Thu, 05 May 2011 16:31:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.916-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>When was my database started ?</title><description>In the database world, it's fair to ask question to database that when have you started? In Oracle world, it can be easily find out by querying system level view V$INSTANCE. In PostgreSQL world, until today, I wasn't able to answer that question without checking database log files.  Today, I asked this question to &lt;a href="http://omniti.com/does/data-management"&gt;OmniTi's&lt;/a&gt; database operations irc channel and got answer in 20 minutes. I regret that I should have asked it earlier but anyways, now I know that in PostgreSQL it's possible using this query.&lt;br /&gt;
&lt;pre&gt;&lt;samp&gt;
omniti=# SELECT (pg_stat_file( 'postmaster.pid')).modification;
      modification      
------------------------
 2010-08-13 15:37:14-04
&lt;/samp&gt; &lt;/pre&gt;If someone complains that database was restarted , it would be easy as DBA to query and verify it. I hope this query will be helpful to you during day-to-day operations!</description><link>http://denishjpatel.blogspot.com/2011/05/when-was-my-database-started.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-5938030783217524564</guid><pubDate>Fri, 25 Mar 2011 19:08:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.917-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>P90X your database!! presentation slides</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;
I just gave talk on "P9ox your database!!" .. here are the slides..&lt;br /&gt;
&lt;br /&gt;
&lt;div style='width:425px;text-align:left'&gt;&lt;object style='margin:0px' width='425' height='355'&gt;&lt;param name='movie' value='http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=p90xyourdatabase-13010796913746-phpapp02&amp;stripped_title=p90-x-your-database' /&gt;&lt;param name='allowFullScreen' value='true'/&gt;&lt;param name='allowScriptAccess' value='always'/&gt;&lt;embed src='http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=p90xyourdatabase-13010796913746-phpapp02&amp;stripped_title=p90-x-your-database' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='425' height='355'&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2011/03/p90x-your-database-presentation-slides.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-9176830288679095383</guid><pubDate>Mon, 14 Mar 2011 12:00:00 +0000</pubDate><atom:updated>2011-03-14T08:00:00.239-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">performance</category><category domain="http://www.blogger.com/atom/ns#">bloat</category><category domain="http://www.blogger.com/atom/ns#">mvcc</category><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>Extreme Training Session at PgEast: P90X your Database!</title><description>&lt;p  style="margin: 0.0px 0.0px 15.0px 0.0px; line-height: 20.0px; font: 13.0px Helvetica; color:#333333;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Over-allocated space in tables and indexes is a very common problem in PostgreSQL database where explosive data growth and changes occurs. This over allocated space is called  "bloat". Bloated tables and indexes waste resources of the system and cause large performance anomaly to the applications. Vacuum process helps to avoid bloat but some cases where even vacuum can not able to recover space for reuse. To shrink tables in such cases, DBA needs special attention and tools to remove bloat from the tables and indexes.&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 15.0px 0.0px; line-height: 20.0px; font: 13.0px Helvetica; color:#333333;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;At &lt;a href="https://www.postgresqlconference.org/"&gt;PgEast 2011&lt;/a&gt;, I will &lt;a href="https://www.postgresqlconference.org/content/p90x-your-database"&gt;discuss&lt;/a&gt;  PostgreSQL MVCC design (compare with  Oracle and MySQL) , ways to avoid bloat and online &amp;amp; offline methods to remove bloat from the tables and indexes. &lt;a href="https://www.postgresqlconference.org/content/p90x-your-database"&gt;P90X your database&lt;/a&gt; talk will help you to keep databases skinnier and faster. If you attending this conference, looking forward to hear your experiences and tools that helps to avoid and remove bloat.&lt;/p&gt;</description><link>http://denishjpatel.blogspot.com/2011/03/extreme-training-session-at-pgeast-p90x.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-3788050340437666874</guid><pubDate>Mon, 17 Jan 2011 21:19:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.917-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>CREATE TABLE ... PARTITION BY RANGE . Will it be possible in PosgreSQL?</title><description>Oracle's easy to create and manage partition table  feature is the best selling point for them to attract wide range of applications to use partitioning features easily . Oracle supports partitioning since &lt;a href="http://www.oracle-base.com/articles/8i/PartitionedTablesAndIndexes.php"&gt;Oracle8i&lt;/a&gt; but there were limited  features in the first release. In Oracle8i, they supported only RANGE and HASH partitions management. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;On the other hand, PostgreSQL support &lt;a href="http://www.postgresql.org/docs/9.0/static/ddl-partitioning.html"&gt;partitioning&lt;/a&gt; but it's cumbersome to create and manage partitioned tables. At least to start with, PostgreSQL should implement commands to make RANGE partition creation and management easy for the users. .&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is an example for creating range partitioned tables in Oracle ...&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;samp&gt;CREATE TABLE users&lt;br /&gt;( user_id    NUMBER NOT NULL,&lt;br /&gt;registration_date  DATE   NOT NULL,&lt;br /&gt;notes      VARCHAR2(500))&lt;br /&gt;PARTITION BY RANGE (registration_date)&lt;br /&gt;(PARTITION users_q1 VALUES LESS THAN (TO_DATE('01/04/2011', 'DD/MM/YYYY')) TABLESPACE users,&lt;br /&gt;PARTITION users_q2 VALUES LESS THAN (TO_DATE('01/07/2011', 'DD/MM/YYYY')) TABLESPACE users,&lt;br /&gt;PARTITION users_q3 VALUES LESS THAN (TO_DATE('01/09/2011', 'DD/MM/YYYY')) TABLESPACE users,&lt;br /&gt;PARTITION users_q4 VALUES LESS THAN (TO_DATE('01/01/2012', 'DD/MM/YYYY')) TABLESPACE users);&lt;/samp&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="Apple-style-span"  style=" white-space: normal;  font-family:Georgia, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;When will I be able to CREATE range partition table and manage with ALTER TABLE commands in PostgreSQL?&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2011/01/create-table-partition-by-range-will-it.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-1731682797811526852</guid><pubDate>Mon, 22 Nov 2010 03:23:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.917-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>Possibility of Graceful Switchover?</title><description>&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;I have been using PITR master-slave solution for long time for "failover" to slave server when there is a problem with the master server. It has proven a valuable solution for most of clients needs. The problem with "failover" solution is that we have to rebuild old-master as slave from completely new base backup from newly promoted master server. Oracle provides nice feature called "&lt;a href="http://www.dsvolk.ru/oracle/backup/graceful_switchover.pdf"&gt;Graceful Switchover&lt;/a&gt;". In this method, you can switch duty between master and slave servers and don't have to rebuild old-master as slave from newly promoted master server. It could be very useful during server or data center move as we can shutdown old database and can have total control over xlogs to be processed before we start traffic on newly promoted master database.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;I couldn't find any graceful switchover document or blog for the PostgreSQL . Today, I  spent some time on testing same theory as Oracle uses for the switchover. Oracle controls switchover using controlfile, Why can't I use pg_control to do the same in totally controlled environment? &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For PostgreSQL graceful switchover,  I tested following scenario on very small test database server with pre configured setup of master and PITR slave database:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Step-1 :&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Shutdown current master database&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Step-2 :&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Apply all wal logs including the one created during shutdown process to slave database server&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Step-3:&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Promote slave as master in read/write mode using triggered failover file &lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Step-4:&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Before pointing production traffic to newly promoted master server, take backup of $PGDATA/global/pg_control and $PGDATA/global/pgstat.stat files. These two files differ between master and slave after failing over slave database into production mode&lt;span class="Apple-style-span"   style="font-family:'Lucida Grande';color:#141414;"&gt;&lt;span class="Apple-style-span" style="line-height: 14px;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Step-5:&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Setup old - master server for slave for newly promoted master sever and  replace $PGDATA/global/pg_control and $PGDATA/global/pgstat.stat&lt;span class="Apple-style-span"   style="  color: rgb(20, 20, 20); line-height: 14px; font-family:'Lucida Grande';font-size:medium;"&gt; &lt;/span&gt;with the files backed up in Step-4&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Step-6:&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Check log files on old-master to make sure that it's recovering copied wal logs from newly promoted master server(old-slave server)&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Yay! I could successfully switched over slave to master and vice versa !&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;At this stage, old-master(new slave) started playing wal logs coming from new-master(old-slave) server. After that, I failed over new slave server to make sure we can actually bring the database in production mode. It worked like a charm!!  I ran database wide vacuum after failover and it ran fine without any error. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have done limited testing as I have tested this with very tiny setup of  "pagila" database on test server and I &lt;b&gt;don't&lt;/b&gt; recommend you to use on the "production database" servers as of now. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Please test this in your &lt;b&gt;test or dev environment&lt;/b&gt; and let me know your results and concerns!!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2010/11/possibility-of-graceful-switchover.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-5877798589509772216</guid><pubDate>Tue, 09 Nov 2010 02:22:00 +0000</pubDate><atom:updated>2010-11-09T15:33:16.104-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">tuning</category><category domain="http://www.blogger.com/atom/ns#">tracking</category><category domain="http://www.blogger.com/atom/ns#">newfeature</category><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>PostgreSQL : Track functions to tune</title><description>&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;  &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Starting from PostgreSQL 8.4, there is a valuable addition in PostgreSQL features list: &lt;b&gt;&lt;i&gt;Per function statistics&lt;/i&gt;&lt;/b&gt;. Prior to this feature , there wasn't an easy way to find out most time consuming functions in the database. &lt;/span&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;  &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;F&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;or time spent on single call, i&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;t's easy to find out by executing function manually but it was too cumbersome and in some cases impossible to find out total time spent by function for the given time period. Enabling full logging and aggregating duration for each call by reading large log files was the only way to get that statistic.  Now, you can find this details by querying a single view  pg_stat_user_functions ! Awesome!&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;To enable function tracking you need to enable "track_functions" postgresql.conf parameter. The default is none, which disables function statistics tracking. Specify &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;pl&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; to track only procedural-language functions, &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;all&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; to also track SQL and C language functions.&lt;/span&gt;&lt;span class="Apple-style-span"   style="  line-height: 18px; font-family:verdana, sans-serif;font-size:12px;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;samp&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;i&gt;#track_functions = none                 # none, pl, all&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/samp&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Once you have track_functions enabled in your database, you can get details by querying pg_stat_user_functions view:&lt;br /&gt;&lt;/span&gt;&lt;samp&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;i&gt;select * from pg_stat_user_functions;&lt;/i&gt;&lt;/span&gt;&lt;/samp&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;i&gt;&lt;samp&gt;&lt;/samp&gt;&lt;samp&gt;&lt;/samp&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;i&gt;&lt;samp&gt;&lt;/samp&gt;&lt;/i&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;It provides following details:&lt;br /&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;samp&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;i&gt;  funcid &lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;i&gt;  schemaname &lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;i&gt;  funcname &lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;i&gt;  calls  &lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;i&gt;  total_time &lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;/samp&gt;&lt;div&gt;&lt;samp&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;i&gt;  self_time&lt;/i&gt;&lt;br /&gt;&lt;/span&gt;&lt;/samp&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Self time is the amount of time spent in the function itself, total time includes the time spent in functions it called. Time values are in milliseconds. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Here is the easy solution to track and find candidate that requires tuning!!&lt;/span&gt;&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2010/11/postgresql-track-functions-to-tune.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-442832273558690</guid><pubDate>Mon, 08 Nov 2010 17:45:00 +0000</pubDate><atom:updated>2010-11-08T16:59:34.806-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">blocking</category><category domain="http://www.blogger.com/atom/ns#">postgresql</category><category domain="http://www.blogger.com/atom/ns#">sessions</category><category domain="http://www.blogger.com/atom/ns#">proactive database monitoring</category><title>What's blocking your way?</title><description>&lt;span class="Apple-style-span"  style=" border-collapse: collapse; color: rgb(51, 51, 51);  line-height: 19px; font-family:'Trebuchet MS', Geneva, Arial, Helvetica, SunSans-Regular, Verdana, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;If you've ever gotten a page about database connections are blocked, or phone call or email from an annoyed user whose transaction just won't go through, or from a developer who can't understand why application sessions are blocking each other, you know how useful it can be to identify not just whose lock is doing the blocking, but what object is locked.&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; Omniti's labs project &lt;/span&gt;&lt;a href="https://labs.omniti.com/projects"&gt;Tasty Treats for PostgreSQL&lt;/a&gt; provides useful tools for proactive database monitoring . &lt;/span&gt;&lt;a href="https://labs.omniti.com/labs/pgtreats/browser/trunk/tools/email_locked_queries.sh"&gt;email_locked_queries&lt;/a&gt;&lt;span&gt; is the new addition to this toolset . This tool can be handy  for proactive lock monitoring in your database to find the blocked and blocking sessions and it sends out email  notification if the there is a connection waiting for lock(s) for more than 10 minutes. It's trivial to  change the query if you want to be notified at different threshold.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;Let's test the query tool and see the results by creating &lt;/span&gt;&lt;b&gt;locking scenario&lt;/b&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;samp&gt;&lt;br /&gt;&lt;/samp&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;samp&gt;postgres=# create table testlock(foo text,bar text);&lt;br /&gt;CREATE TABLE&lt;br /&gt;postgres=# insert into testlock values ('lock','me');&lt;br /&gt;INSERT 0 1 postgres=# insert into testlock values ('find','me');&lt;br /&gt;INSERT 0 1&lt;br /&gt;postgres=# select * from testlock;&lt;br /&gt;foo  | bar&lt;br /&gt;------+-----&lt;br /&gt;find | me &lt;/samp&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;samp&gt;lock | me &lt;/samp&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;samp&gt;(2 rows)&lt;br /&gt;&lt;/samp&gt;&lt;br /&gt;&lt;b&gt;Session 1&lt;/b&gt;:&lt;span class="Apple-style-span"   style="font-family:monospace;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style=" white-space: pre;font-size:13px;"&gt;&lt;span class="Apple-style-span"   style="font-family:Georgia, serif;font-size:130%;"&gt;&lt;span class="Apple-style-span"  style=" white-space: normal;font-size:16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;pre&gt;&lt;samp&gt;postgres=# begin;&lt;br /&gt;BEGIN&lt;br /&gt;postgres=# update testlock set foo='hang' where foo='lock';&lt;br /&gt;UPDATE 1&lt;br /&gt;&lt;/samp&gt;&lt;/pre&gt;And &lt;/span&gt;&lt;b&gt;Session 2&lt;/b&gt;&lt;span&gt;, try to update same row:&lt;span class="Apple-style-span"   style="  white-space: pre; font-family:monospace;font-size:13px;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;samp&gt;postgres=# begin;&lt;br /&gt;BEGIN&lt;br /&gt;postgres=# update testlock set foo='escapeme' where foo='lock';&lt;span class="Apple-style-span"   style="font-family:Georgia, serif;font-size:130%;"&gt;&lt;span class="Apple-style-span"  style=" white-space: normal;font-size:16px;"&gt;&lt;span class="Apple-style-span"   style="font-family:monospace;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style=" white-space: pre;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/samp&gt;&lt;/pre&gt;This statement will hang, blocked by the lock that Session 1 is holding on the row.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;I ran the query tool and I got this in my email:&lt;span class="Apple-style-span"   style="  white-space: pre; font-family:monospace;font-size:13px;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;samp&gt;-[ RECORD 1 ]&lt;br /&gt;--------+-----------------------------------------------------&lt;br /&gt;locked_relation      |&lt;br /&gt;locked_mode          | ShareLock&lt;br /&gt;blocked_pid          | 9468&lt;br /&gt;blocked_user         | postgres&lt;br /&gt;blocked_statement    | update testlock set foo='escapeme' where foo='lock';&lt;br /&gt;blocked_client_addr  |&lt;br /&gt;blocked_query_age    | 00:10:28.98475&lt;br /&gt;blocking_pid         | 8056&lt;br /&gt;blocking_user        | postgres&lt;br /&gt;blocking_statement   | IDLE&lt;idle&gt; in transaction&lt;br /&gt;blocking_client_addr |&lt;br /&gt;blocking_query_age   | 00:10:24.403767&lt;br /&gt;blocking_xact_age    | 00:10:58.529881&lt;br /&gt;&lt;/idle&gt;&lt;/samp&gt;&lt;/pre&gt;Let me know if you have suggestions to make it more better.&lt;br /&gt;&lt;/span&gt;&lt;samp&gt;&lt;/samp&gt;&lt;/span&gt;&lt;samp&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style=" border-collapse: collapse; color: rgb(51, 51, 51);  line-height: 19px; font-family:'Trebuchet MS', Geneva, Arial, Helvetica, SunSans-Regular, Verdana, sans-serif;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/samp&gt;&lt;/div&gt;&lt;samp&gt;&lt;/samp&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2010/11/whats-blocking-your-way.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-1237592857550127089</guid><pubDate>Wed, 03 Nov 2010 21:58:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.918-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>Achieving PCI Compliance with PostgreSQL</title><description>Today, I gave Security talk on &lt;a href="https://www.postgresqlconference.org/content/achieve-pci-compliance-postgresql"&gt;Achieving PCI Compliance&lt;/a&gt; at PgWest 2010, San Francisco. Slides are available to &lt;a href="http://www.slideshare.net/denishpatel/achieving-pci-compliace-5659979"&gt;download&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div style='width:425px;text-align:left'&gt;&lt;object style='margin:0px' width='425' height='355'&gt;&lt;param name='movie' value='http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=achievingpcicompliace-12888219148022-phpapp02&amp;stripped_title=achieving-pci-compliace-5659979' /&gt;&lt;param name='allowFullScreen' value='true'/&gt;&lt;param name='allowScriptAccess' value='always'/&gt;&lt;embed src='http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=achievingpcicompliace-12888219148022-phpapp02&amp;stripped_title=achieving-pci-compliace-5659979' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='425' height='355'&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2010/11/achieving-pci-compliance-with.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-8545903683055814408</guid><pubDate>Sun, 24 Oct 2010 15:35:00 +0000</pubDate><atom:updated>2010-10-25T08:18:00.365-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">pgwest2010</category><category domain="http://www.blogger.com/atom/ns#">security</category><category domain="http://www.blogger.com/atom/ns#">database</category><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>Security &amp; PgWest2010</title><description>Open Source databases still needs solid presence in enterprise world.  One of the &lt;a href="https://enterprisedb.webex.com/mw0306lb/mywebex/default.do?nomenu=true&amp;amp;siteurl=enterprisedb&amp;amp;service=6&amp;amp;main_url=https%3A%2F%2Fenterprisedb.webex.com%2Fec0605lb%2Feventcenter%2Fevent%2FeventAction.do%3FtheAction%3Ddetail%26confViewID%3D631845987%26siteurl%3Denterprisedb%26%26%26"&gt;myths&lt;/a&gt; about open source databases is that they aren't secure.  To eliminate this myth we have to share our experience related to security aspect of PostgreSQL database. At &lt;a href="http://omniti.com/"&gt;OmniTi&lt;/a&gt; , we help businesses to achieve &lt;a href="https://www.pcisecuritystandards.org/index.shtml"&gt;PCI compliance&lt;/a&gt; or provide payment processor:&lt;a href="http://omniti.com/offers/paypi"&gt;PayPI&lt;/a&gt; . &lt;a href="http://omniti.com/offers/paypi"&gt;PayPI&lt;/a&gt; runs on &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; database. &lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;/span&gt;I feel that Security aspect of the PostgreSQL database isn't marketed as it should be. Who doesn't want secured applications and databases ? The answer is everyone cares about security but we can't able to find many talks about security in the open source conferences. &lt;a href="https://www.postgresqlconference.org/2010/west/"&gt;PgWest 2010&lt;/a&gt; has wide &lt;a href="https://www.postgresqlconference.org/2010/west/talks"&gt;variety of talks&lt;/a&gt;. Thanks to conference committee to include number of talks about security aspects of application and database.  One of them is &lt;a href="https://www.postgresqlconference.org/users/denish"&gt;my&lt;/a&gt; session that will talk about &lt;a href="https://www.postgresqlconference.org/content/achieve-pci-compliance-postgresql"&gt;achieving PCI compliance with PostgreSQL&lt;/a&gt;. If your system transmit, process or store credit card data then it should be PCI compliance system. Please don't miss this opportunity to share your knowledge &amp;amp; experience during the talk. Even if your system doesn't need PCI compliance, we can still discuss about security in general and share knowledge about features related to security.&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;/span&gt;If you are planning to attend PgWest 2010 at San Francisco from Nov 2, 2010 to Nov 4, 2010,  looking forward to see you in-person.&lt;/div&gt;&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2010/10/security-pgwest2010.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-3214546184268001169</guid><pubDate>Wed, 01 Sep 2010 01:58:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.918-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>Outlining  Surge Conference Sessions</title><description>&lt;div&gt;&lt;a href="http://omniti.com/"&gt;OmniTi's&lt;/a&gt; &lt;a href="http://omniti.com/surge/2010"&gt;Surge&lt;/a&gt; conference is around the corner (Sept 30th)  and there are plenty of industry leading &lt;a href="http://omniti.com/surge/2010/speakers"&gt;speakers&lt;/a&gt; and most advance technology &lt;a href="http://omniti.com/surge/2010/sessions"&gt;sessions&lt;/a&gt; to choose from list. Most probably I will be attending second day of two days conference.  I spent a lot of time to decide on  most interesting sessions to attend from wide variety of sessions. In the past, for other conferences, I found easy to choose from two parallel sessions but it's not the case at Surge. It's one of the most difficult task to choose one from two parallel talks.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; I hope my list will help you to outline your sessions or at least encourage you to think now! &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is my outline of sessions to attend at Surge Conference on Day -2:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt; Enterprise solutions from commodity components: The Promise and the Peril - Bryan Cantrill &lt;/li&gt;&lt;li&gt;Don't bet the farm on your cache - Brian Akins &lt;/li&gt;&lt;li&gt;Top 10 Lessons Learned from Deploying Hadoop in a Private Cloud - Rod Cope &lt;/li&gt;&lt;li&gt;Design for Scale - Patterns, Anti-Patterns, Successes and Failures - Christopher Brown&lt;/li&gt;&lt;li&gt;From disaster to stability: scaling challenges of my.opera.com -Cosimo Streppone &lt;/li&gt;&lt;li&gt;Availability, the Cloud and Everything -Joe Williams &lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2010/08/outlining-surge-conference-sessions.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-561874836312960008</guid><pubDate>Thu, 01 Apr 2010 14:42:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.919-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>PostgreSQL Recovery Manager - PG_RMAN</title><description>&lt;div&gt;During &lt;a href="http://postgresqlconference.org/2010/east"&gt;PgEast&lt;/a&gt;, I heard a lot about making PostgreSQL acceptable at more enterprise shops. I firmly believe that PostgreSQL has potential but lack of  marketing perspective during the promotion of product and tools. Anyways, let's start creating/testing/using and telling new tools those can be attracted by C-Level people!!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you have Oracle background , you must know &lt;a href="http://www.oracle.com/"&gt;Oracle&lt;/a&gt; Recovery Manager - &lt;a href="http://www.oracle.com/technology/deploy/availability/htdocs/RMAN_Overview.htm"&gt;RMAN&lt;/a&gt;. Oracle has RMAN since Oracle7i (may be longer ). It has been enhanced during each &lt;a href="http://www.oracle-base.com/articles/10g/RMANEnhancements10g.php"&gt;release&lt;/a&gt;. It is widely used program at most of the Oracle shops.  Obviously, Oracle puts lots of marketing efforts around RMAN features per release.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I came across a &lt;a href="http://code.google.com/"&gt;Google Code project&lt;/a&gt; called &lt;a href="http://code.google.com/p/pg-rman/"&gt;pg_rman&lt;/a&gt;, which is developed by NTT Open Source Software Center. It looks promising by looking at features list. If i compare these features with Oracle, it includes features comparable to &lt;a href="http://www.oracle-base.com/articles/9i/RecoveryManagerEnhancements9i.php"&gt;Oracle9i RMAN&lt;/a&gt; feature list.&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre; font-family:monospace, arial, sans-serif;font-size:medium;"&gt;pg_rman features:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre; font-family:monospace, arial, sans-serif;font-size:medium;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style=" white-space: pre; font-family:monospace, arial, sans-serif;"&gt;Ease of use. Backup and restore can be done with just one command.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style=" white-space: pre; font-family:monospace, arial, sans-serif;"&gt;Online full backup, incremental backup, and archive backup.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style=" white-space: pre; font-family:monospace, arial, sans-serif;"&gt;Backup compression. Unused area in pages are removed and only actual data are compressed with gzip.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style=" white-space: pre; font-family:monospace, arial, sans-serif;"&gt;Automatic backup maintenance. Backup and archive WAL files older   than specified days are deleted automatically.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style=" white-space: pre; font-family:monospace, arial, sans-serif;"&gt;Backup validation. Backup can be validated with CRC checks&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style=" white-space: pre; font-family:monospace, arial, sans-serif;"&gt;No transaction lost in restore. Configuration file generator for point-in-time recovery is supported.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:monospace, arial, sans-serif;font-size:medium;"&gt;&lt;pre&gt;&lt;span class="Apple-style-span"  style=" white-space: normal;  font-family:Georgia, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Let's put hands together to test a new tool and help making PostgreSQL more advanced with adding these rich tools!!&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;I am going to test the pg_rman pretty soon!!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2010/04/postgresql-recovery-manager-pgrman.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>38</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-8605842137075759484</guid><pubDate>Sat, 27 Mar 2010 02:06:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.919-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>RubyRep Presentation Slides</title><description>Guys,&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Today I gave presentation @ &lt;a href="http://postgresqlconference.org/2010/east/talks/yet_another_replication_tool_rubyrep"&gt;PgEast2010&lt;/a&gt; in Philadelphia. You can download slides &lt;a href="http://www.slideshare.net/denishpatel/yet-another-replication-tool-rubyrep"&gt;Here&lt;/a&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Thanks for attending or following it!!&lt;/div&gt;&lt;br /&gt;
&lt;div style='width:425px;text-align:left'&gt;&lt;object style='margin:0px' width='425' height='355'&gt;&lt;param name='movie' value='http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=rubyrepv2-100326211120-phpapp01&amp;stripped_title=yet-another-replication-tool-rubyrep' /&gt;&lt;param name='allowFullScreen' value='true'/&gt;&lt;param name='allowScriptAccess' value='always'/&gt;&lt;embed src='http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=rubyrepv2-100326211120-phpapp01&amp;stripped_title=yet-another-replication-tool-rubyrep' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='425' height='355'&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2010/03/rubyrep-presentation-slides.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-3213043638979050924</guid><pubDate>Thu, 11 Mar 2010 21:57:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.919-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>Heading to PgEast</title><description>Guys,&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I will be in Philadelphia on 25th and 26th March 2010 to attend &lt;a href="http://postgresqlconference.org/"&gt;PgEast&lt;/a&gt; PostgreSQL conference. Moreover, I will be speaking on &lt;a href="http://postgresqlconference.org/2010/east/talks/yet_another_replication_tool_rubyrep"&gt;RubyRep&lt;/a&gt; on 26th March 2010. If you are attending this conference , see you there!&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2010/03/heading-to-pgeast.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-3711484770177301191</guid><pubDate>Wed, 20 Jan 2010 17:40:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.920-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>Secure your web from SQL Injections</title><description>Last couple of months, I came across two incidents of SQL injections due to most common errors by IT professionals.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://www.darkreading.com/blog/archives/2009/11/how_to_hack_a_b.html"&gt;How To Hack A Brazilian Power Company&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.darkreading.com/blog/archives/2009/11/how_to_hack_a_b.html"&gt;&lt;/a&gt; &lt;a href="http://www.thetechherald.com/article.php/200949/4878/SQL-Injection-discovered-on-Wall-Street-Journal"&gt;SQL Injection discovered on Wall Street Journal &lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Both incidents are stunning and they were exploited by hackers with minimal effort. Little care during web application development could avoid both incidents.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you are IT professional , you must know about SQL injections' cause and remedy.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/SQL_injection"&gt;wikipedia&lt;/a&gt; provides detailed definition :&lt;br /&gt;&lt;br /&gt;"SQL injection is a code injection technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another. SQL injection attacks are also known as SQL insertion attacks."&lt;br /&gt;&lt;br /&gt;Most common SQL injections are:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1.  Incorrectly filtered escape characters&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Most common is Quote or Special character handling&lt;/li&gt;&lt;/ul&gt;     2.  Incorrect type handling&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Brazil incident fall into this category&lt;/li&gt;&lt;/ul&gt;     3.  Vulnerabilities inside the database server&lt;br /&gt;&lt;ul&gt;&lt;li&gt;WSJ incident fall into this category : BAD password!&lt;/li&gt;&lt;/ul&gt;    4.   Blind SQL injection&lt;br /&gt;&lt;ul&gt;&lt;li&gt;       Result of this attack is not visible to hacker but it can help to exploit more SQL injections.&lt;/li&gt;&lt;li&gt;conditional responses&lt;/li&gt;&lt;li&gt;conditional errors&lt;/li&gt;&lt;li&gt;execute long running queries&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;You can avoid these catastrophic SQL injections by little care during the web application coding such as using bind variables, verify input values and take care of escaping characters. Database level security such as password and access control also help to avoid SQL injections.&lt;br /&gt;&lt;br /&gt;I hope this will save you from future SQL injection :-)&lt;/div&gt;</description><link>http://denishjpatel.blogspot.com/2010/01/secure-your-web-from-sql-injections.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-9009531143492897850</guid><pubDate>Fri, 09 Oct 2009 14:43:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.920-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgres</category><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>Postgres 8.4 - Replace regular index with Text Based Index</title><description>I came across a nice post by &lt;a href="http://petereisentraut.blogspot.com/2009/10/rethink-your-text-column-indexing-with.html"&gt;Peter Eisentraut&lt;/a&gt; that shows how text based index can be used to do direct lookup on the text fields.&lt;br /&gt;&lt;br /&gt;Quick test proves that..&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;samp&gt;&lt;br /&gt;postgres=# \d employees&lt;br /&gt;  Table "public.employees"&lt;br /&gt;Column |  Type   | Modifiers&lt;br /&gt;--------+---------+-----------&lt;br /&gt;emp_id | integer | not null&lt;br /&gt;name   | text    |&lt;br /&gt;Indexes:&lt;br /&gt;   "employees_pkey" PRIMARY KEY, btree (emp_id)&lt;br /&gt;&lt;br /&gt;postgres=# create index idx_employees_name on employees(name);&lt;br /&gt;CREATE INDEX&lt;br /&gt;postgres=# explain select * from employees where name like 'Denish%';&lt;br /&gt;                       QUERY PLAN                        &lt;br /&gt;-----------------------------------------------------------&lt;br /&gt;Seq Scan on employees  (cost=0.00..25.38 rows=6 width=36)&lt;br /&gt;  Filter: (name ~~ 'Denish%'::text)&lt;br /&gt;(2 rows)&lt;br /&gt;&lt;br /&gt;postgres=# explain select * from employees where name='Denish';&lt;br /&gt;                                  QUERY PLAN                                   &lt;br /&gt;---------------------------------------------------------------------------------&lt;br /&gt;Bitmap Heap Scan on employees  (cost=4.30..13.76 rows=6 width=36)&lt;br /&gt;  Recheck Cond: (name = 'Denish'::text)&lt;br /&gt;  -&gt;  Bitmap Index Scan on idx_employees_name  (cost=0.00..4.30 rows=6 width=0)&lt;br /&gt;        Index Cond: (name = 'Denish'::text)&lt;br /&gt;(4 rows)&lt;br /&gt;&lt;br /&gt;postgres=# create index idx_employees_name_like on employees (name text_pattern_ops);&lt;br /&gt;CREATE INDEX&lt;br /&gt;postgres=# explain select * from employees where name like 'Denish%';&lt;br /&gt;                                     QUERY PLAN                                     &lt;br /&gt;--------------------------------------------------------------------------------------&lt;br /&gt;Bitmap Heap Scan on employees  (cost=4.31..13.78 rows=6 width=36)&lt;br /&gt;  Filter: (name ~~ 'Denish%'::text)&lt;br /&gt;  -&gt;  Bitmap Index Scan on idx_employees_name_like  (cost=0.00..4.31 rows=6 width=0)&lt;br /&gt;        Index Cond: ((name ~&gt;=~ 'Denish'::text) AND (name ~&lt;~ 'Denisi'::text)) (4 rows)  postgres=# drop index idx_employees_name; DROP INDEX postgres=# explain select * from employees where name='Denish';                                       QUERY PLAN                                       --------------------------------------------------------------------------------------  Bitmap Heap Scan on employees  (cost=4.30..13.76 rows=6 width=36)    Recheck Cond: (name = 'Denish'::text)    -&gt;  Bitmap Index Scan on idx_employees_name_like  (cost=0.00..4.30 rows=6 width=0)&lt;br /&gt;        Index Cond: (name = 'Denish'::text)&lt;br /&gt;(4 rows)&lt;br /&gt;&lt;br /&gt;&lt;/samp&gt; &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Above example shows that we don't need regular index on name field as text based index (idx_employees_name_like) fulfill the gap. However, if we do range query i.e select * from employees where name &gt; 'denish' and name&lt;'patel' then text based index will not be used. I don't think we ever run a range query on text based fields!.</description><link>http://denishjpatel.blogspot.com/2009/10/redo-index-strategy-for-text-based.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-8587513361817072201</guid><pubDate>Tue, 01 Sep 2009 18:04:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.921-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>xargs foo!</title><description>xargs foo helps a lot for running parallel operation..&lt;br /&gt;&lt;br /&gt;This is the example , how we can rebuild indexes parallel on postgres&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;br /&gt;cat create_index.sql | xargs -d "\n" -L1 -P10 -I _CREATE_ psql -qAt -U postgres -p 5432 -d pagila -c "_CREATE_"&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;</description><link>http://denishjpatel.blogspot.com/2009/09/xargs-foo.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6356223856264576429.post-1198788765511504535</guid><pubDate>Thu, 20 Aug 2009 15:22:00 +0000</pubDate><atom:updated>2011-12-16T07:40:48.921-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">postgresql</category><title>Yet Another PostgreSQL Replication Tool - RubyRep</title><description>One of the key features any enterprise considers when choosing a database technology for their architecture solution stack is that of replication. &lt;a href="http://www.oracle.com/technology/products/dataint/index.html"&gt;Oracle&lt;/a&gt; and &lt;a href="http://dev.mysql.com/doc/refman/5.1/en/replication.html"&gt;MySQL&lt;/a&gt; both have built in replication solutions, but as of yet PostgreSQL doesn't support a built in replication solution. There are many &lt;a href="http://wiki.postgresql.org/wiki/Replication%2C_Clustering%2C_and_Connection_Pooling"&gt;replication solutions&lt;/a&gt; available however, and different companies are using different solutions customized for their needs.&lt;p&gt;&lt;/p&gt;Among all of the solutions, &lt;a href="http://www.slony.info/"&gt;Slony&lt;/a&gt; is probably the most widely tested and deployed within organizations, although it does have the following limitations:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Replicated tables must have a unique or primary key&lt;/li&gt;&lt;br /&gt;&lt;li&gt;It does not support replication of large objects&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Schema changes are not propagated (though they can be coordinated)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;It does not support synchronizing databases outside of replication&lt;/li&gt;&lt;br /&gt;&lt;li&gt;There are limitations on version compatability; you can not replicate from PostgreSQL 8.2 to PostgreSQL 8.4 for example&lt;/li&gt;&lt;br /&gt;&lt;li&gt;It is more difficult to set up than many other replication solutions&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;One new alternative to Slony is a project known as &lt;a href="http://www.rubyrep.org/index.html"&gt;RubyRep&lt;/a&gt;, which is designed to avoid some of the limitations of Slony.  RubyRep provides both master-slave and master-master replication, and it works for PostgreSQL as well as MySQL. It is currently developed by &lt;a href="http://www.arndtlehmann.com/"&gt;Arndt Lehmann&lt;/a&gt;, a German who has been living since 2001 in Tokyo, Japan. He also provides great support to the &lt;a href="http://groups.google.com/group/rubyrep"&gt;RubyRep mailing list&lt;/a&gt;, especially for adding new features or fixing bugs.&lt;br /&gt; &lt;br /&gt;RubyRep always operates on two databases. To make it simple to understand, the databases are referred to as "left" and "right" database respectively.&lt;br /&gt;&lt;br /&gt;RubyRep's key features includes:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Simple configuration, complete setup can be done via single configuration file.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Simple Installation, if you have a JVM installed, then you just have to download and extract the files. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;Platform Independent, it runs on Unix and Windows platform. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;Table Design Independent, meaning that all commands work on tables no matter if they have a simple primary key (all data types acceptable), a combined primary key, or no primary key at all. It successfully processes multi-byte texts and "big" data types&lt;/li&gt;&lt;li&gt;It replicates tsvector datatype&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;In addition to the above, RubyRep actually provides three tools in one; a Compare, Sync, and Replication tools.&lt;br /&gt;&lt;h3&gt; Compare &lt;/h3&gt;&lt;br /&gt;This tool scans corresponding tables of left and right database, looking for diverging data. Key features of the comparison tool are:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Different output modes, from a count of differences to full row dumps.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Low bandwidth mode available, reducing the number of round-trips so only actual differences go through the network.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;A progress bar with estimated remaining amount of work.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Server load is targeted toward only the "right" database server.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;In one test we ran, we compared two 50 million row tables in around 3 hours, without affecting production server load. This is accomplished by comparing rows in batches, and you can adjust the batch size in the configuration file.&lt;br /&gt;&lt;h3&gt; Sync &lt;/h3&gt;&lt;br /&gt;   The sync tool is used to synchronize data in corresponding tables of a left and right pair of databases. Key features of the sync tool are:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;All features of the Compare tool also apply to syncs&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Automatically orders table syncs to avoid foreign key conflicts.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;You can configure the Sync policy to ignore deletes in left database, or to ignore creating records in right database, and other such combinations&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Provides two prebuilt conflict resolution methods, either left db wins or right db wins&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Custom conflict resolution methods specifiable via ruby code snippets&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Merge decisions can optionally be logged in the rubyrep event log table.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt; Replicate &lt;/h3&gt;&lt;br /&gt;Of course RubyRep also provides a replication tool. Some of the key features of the replication tool include:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Automatically sets up all necessary triggers, log tables, etc.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Automatically discovers newly added tables and synchronizes the table content&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Automatically reconfigures sequences to avoid duplicate key conflicts&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Tracks changes to primary key columns&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Can implement either master-slave or master-master replication&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Prebuilt conflict resolution methods available include left or right wins, or earlier, later change wins&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Custom conflict resolution specifiable via ruby code snippets&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Replication decisions can optionally be logged in the rubyrep event log table&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;       One of the problems common to replication solutions is that of setting up new nodes. With Slony, there are always some headaches caused by high load on master database server, as a result of the TRUNCATE/COPY cycle Slony goes through. In the case of RubyRep, most of the CPU load is on the slave server, and you can use the Sync command in advance before you start replicating database. RubyRep also provides some flexibility to ignore the Sync commands if you don't want to sync the database again.&lt;br /&gt;&lt;h3&gt; RubyRep in action... &lt;/h3&gt;&lt;br /&gt;&lt;ul&gt; &lt;li&gt;Help &lt;/li&gt;&lt;br /&gt;&lt;pre&gt; &lt;samp&gt;&lt;br /&gt;; ./rubyrep --help&lt;br /&gt;Usage: ./bin/rubyrep [general options] command [parameters, ...]&lt;br /&gt;Asynchronous master-master replication of relational databases.&lt;br /&gt;Available options:&lt;br /&gt;       --verbose                    Show errors with full stack trace&lt;br /&gt;   -v, --version                    Show version information.&lt;br /&gt;       --help                       Show this message&lt;br /&gt;Available commands:&lt;br /&gt; generate        Generates a configuration file template&lt;br /&gt; help            Shows detailed help for the specified command&lt;br /&gt; proxy           Proxies connections from rubyrep commands to the database&lt;br /&gt; replicate       Starts a replication process&lt;br /&gt; scan            Scans for differing records between databases&lt;br /&gt; sync            Syncs records between databases&lt;br /&gt; uninstall       Removes all rubyrep tables, triggers, etc. from "left" and "right" database&lt;br /&gt;&lt;/samp&gt; &lt;/pre&gt;&lt;br /&gt;&lt;li&gt; Generate configuration file &lt;/li&gt;&lt;br /&gt;&lt;pre&gt; &lt;samp&gt;&lt;br /&gt;; ./rubyrep generate pagila.conf&lt;br /&gt;&lt;/samp&gt; &lt;/pre&gt;&lt;br /&gt;&lt;li&gt; Compare/Sync Example: &lt;/li&gt;&lt;br /&gt;&lt;pre&gt; &lt;samp&gt;&lt;br /&gt;; cat pagila.conf&lt;br /&gt; RR::Initializer::run do |config|&lt;br /&gt; config.left = {&lt;br /&gt;   :adapter  =&gt; 'postgresql', # or 'mysql'&lt;br /&gt;   :database =&gt; 'pagila,&lt;br /&gt;   :username =&gt; 'rubyrep',&lt;br /&gt;   :password =&gt; 'rubyrep',&lt;br /&gt;   :host     =&gt; '192.168.0.1',&lt;br /&gt;   :port =&gt;'5432'&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; config.right = {&lt;br /&gt;   :adapter  =&gt; 'postgresql',&lt;br /&gt;   :database =&gt; 'pagila',&lt;br /&gt;   :username =&gt; 'rubyrep',&lt;br /&gt;   :password =&gt; 'rubyrep',&lt;br /&gt;   :host     =&gt; '127,0.0.1',&lt;br /&gt;   :port     =&gt; '5483'&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; config.include_tables 'users'&lt;br /&gt; # config.include_tables /^e/ # regexp matching all tables starting with e&lt;br /&gt; # config.include_tables /./ # regexp matching all tables in the database&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;; ./rubyrep scan -d=keys -b -c pagila.conf  &gt; users_diff.log&lt;br /&gt;; cat users_diff.log&lt;br /&gt;users             users .........................  1&lt;br /&gt;---&lt;br /&gt;:conflict:&lt;br /&gt;- lastname: patel&lt;br /&gt; zipcode: "2096"&lt;br /&gt; ipaddress: 192.168.0.126&lt;br /&gt;userid: 48212620&lt;br /&gt;address: columbia&lt;br /&gt;&lt;br /&gt;; ./rubyrep sync -c pagila.conf&lt;br /&gt;&lt;/samp&gt; &lt;/pre&gt;&lt;br /&gt;&lt;li&gt; Replication example: &lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;   By default, RubyRep runs in master-master replication mode, but you can adjust the following configuration setting to make it master-slave replication:&lt;br /&gt;&lt;pre&gt;&lt;samp&gt;&lt;br /&gt;; cat pagila_replicate.conf&lt;br /&gt;RR::Initializer::run do |config|&lt;br /&gt; config.left = {&lt;br /&gt;   :adapter  =&gt; 'postgresql',&lt;br /&gt;   :database =&gt; 'pagila,&lt;br /&gt;   :username =&gt; 'rubyrep',&lt;br /&gt;   :password =&gt; 'rubyrep',&lt;br /&gt;   :host     =&gt; '192.168.0.1',&lt;br /&gt;   :port =&gt;'5432',&lt;br /&gt;   :schema_search_path =&gt; 'public,pagila'&lt;br /&gt; }&lt;br /&gt; config.right = {&lt;br /&gt;   :adapter  =&gt; 'postgresql',&lt;br /&gt;   :database =&gt; 'pagila',&lt;br /&gt;   :username =&gt; 'rubyrep',&lt;br /&gt;   :password =&gt; 'rubyrep',&lt;br /&gt;   :host     =&gt; '127,0.0.1',&lt;br /&gt;   :port     =&gt; '5483',&lt;br /&gt;   :schema_search_path =&gt; 'public,pagila'&lt;br /&gt; }&lt;br /&gt;  config.include_tables /./ # regexp matching all tables in the database&lt;br /&gt;  config.options[:auto_key_limit] = 60&lt;br /&gt;  config.options[:adjust_sequences] = false&lt;br /&gt;  config.options[:sequence_increment] = 1&lt;br /&gt;  #Sync Policy: Changes in the right database will not be applied to the left database.&lt;br /&gt;  config.options[:right_record_handling] = :ignore&lt;br /&gt;  config.options[:sync_conflict_handling] = :left_wins&lt;br /&gt; # Additional logging&lt;br /&gt; config.options[:logged_replication_events] = [&lt;br /&gt;                                        :ignored_changes,&lt;br /&gt;                                        :ignored_conflicts&lt;br /&gt;                                               ]&lt;br /&gt;#ignore history tables&lt;br /&gt;config.exclude_tables /_history/&lt;br /&gt;config.exclude_tables 'test1'&lt;br /&gt;config.exclude_tables 'pagila'&lt;br /&gt;end&lt;/samp&gt;&lt;/pre&gt;&lt;br /&gt;  Detailed information for the each configuration setting can be found in the &lt;a href="http://www.rubyrep.org/configuration.html"&gt;RubyRep documentation&lt;/a&gt;. There are also sample configuration files and a tutorial available too for getting familiar with each of the features RubyRep offers. Based on our initial testing, it should also be possible to upgrade some older PostgreSQL databases from 8.2 to 8.4.</description><link>http://denishjpatel.blogspot.com/2009/08/yet-another-postgresql-replication-tool.html</link><author>noreply@blogger.com (Denish Patel)</author><thr:total>4</thr:total></item></channel></rss>
