<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-20038672</id><updated>2012-02-03T00:17:28.267-05:00</updated><category term='linux'/><category term='microsoft'/><category term='troubleshooting'/><category term='nosql'/><category term='selinux'/><category term='surge'/><category term='index-only'/><category term='postgresql'/><category term='glibc'/><category term='mysql'/><category term='git'/><category term='google'/><title type='text'>Robert Haas</title><subtitle type='html'>Database Architect @ EnterpriseDB, PostgreSQL Committer</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>88</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-20038672.post-2238515399456302539</id><published>2012-01-12T10:01:00.001-05:00</published><updated>2012-01-30T13:56:56.239-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Linux Memory Reporting</title><content type='html'>As much as I like Linux (and, really, I do: I ran Linux 0.99.something on my desktop in college, and wrote my class papers using vim and LaTeX), there are certain things about it that drive me crazy, and the way it reports memory usage is definitely on the list.  It should be possible for a reasonably intelligent human being (in which category I place myself) to answer simple questions about system memory usage, such as &amp;quot;How much memory is my database using?&amp;quot; or &amp;quot;How much memory is my web server using?&amp;quot; relatively simply.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2012/01/linux-memory-reporting.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-2238515399456302539?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/2238515399456302539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=2238515399456302539' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2238515399456302539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2238515399456302539'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2012/01/linux-memory-reporting.html' title='Linux Memory Reporting'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1512107566129989901</id><published>2011-12-15T11:28:00.000-05:00</published><updated>2011-12-15T11:28:24.699-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Write Scalability</title><content type='html'>Time flies when you&amp;#39;re benchmarking.  I noticed today that it&amp;#39;s been over a month since my last blog post, so it&amp;#39;s past time for an update.  One of the great things about the PostgreSQL community is that it is full of smart people.  One of them is my colleague Pavan Deolasee, who &lt;a href="http://archives.postgresql.org/pgsql-hackers/2011-11/msg00171.php"&gt;came up with a great idea&lt;/a&gt; for reducing contention on one of PostgreSQL&amp;#39;s most heavily-trafficked locks: ProcArrayLock.  Heikki Linnakangas (another really smart guy, who is also a colleague of mine) &lt;a href="http://archives.postgresql.org/pgsql-hackers/2011-11/msg00319.php"&gt;did some more work on the patch&lt;/a&gt;, and then I cleaned it up further and &lt;a href="http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=ed0b409d22346b1b027a4c2099ca66984d94b6dd"&gt;committed it&lt;/a&gt;.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/12/write-scalability.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1512107566129989901?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1512107566129989901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1512107566129989901' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1512107566129989901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1512107566129989901'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/12/write-scalability.html' title='Write Scalability'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-5569860806410993257</id><published>2011-11-14T12:07:00.000-05:00</published><updated>2011-11-14T12:07:02.616-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Linux lseek scalability</title><content type='html'>I don't normally follow Linux kernel development, but I was pleased to hear (&lt;a href="http://archives.postgresql.org/pgsql-hackers/2011-10/msg01545.php"&gt;via Andres Freund&lt;/a&gt;) that the Linux kernel developers have committed a series of patches by Andi Kleen to reduce locking around the lseek() system call.&amp;nbsp; As I &lt;a href="http://rhaas.blogspot.com/2011/08/linux-and-glibc-scalability.html"&gt;blogged about back in August&lt;/a&gt;, PostgreSQL calls lseek quite frequently (to determine the file length, not to actually move the file pointer), and due to the performance enhancements in 9.2devel, it's now much easier to hit the contention problems that can be caused by frequently acquiring and releasing the inode mutex.&amp;nbsp; But it looks like this should be fixed in Linux 3.2, which is now at &lt;a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=tree;h=01099b45d72a6b9977cebe34b97938b07d00a0b5;hb=1ea6b8f48918282bdca0b32a34095504ee65bab5"&gt;rc1&lt;/a&gt;, and therefore on track to be released well before PostgreSQL 9.2.&lt;br /&gt;&lt;br /&gt;Meanwhile, we're gearing up for &lt;a href="https://commitfest.postgresql.org/action/commitfest_view?id=12"&gt;CommitFest #3&lt;/a&gt;.&amp;nbsp; Interesting stuff in this CommitFest includes Álvaro Herrera's work on reducing foreign key lock strength and a PostgreSQL foreign data wrapper (pgsql_fdw) by Hanada Shigeru.&amp;nbsp; Reviewers are needed, for those and many other patches!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-5569860806410993257?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/5569860806410993257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=5569860806410993257' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5569860806410993257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5569860806410993257'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/11/linux-lseek-scalability.html' title='Linux lseek scalability'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-5522648582512547739</id><published>2011-11-10T13:41:00.001-05:00</published><updated>2011-11-10T13:41:25.985-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Unsticking VACUUM</title><content type='html'>Every PostgreSQL release adds new features, but sometimes the key to a release has less to do with what you add than with what you take away.  PostgreSQL 8.4, for example, removed the settings max_fsm_pages and max_fsm_relations, and replaced them with a per-relation free space map that no longer requires manual sizing.  Those parameters are now gone, and more importantly, something that you previously needed to understand and manage was replaced with something that just works.   People who are still running PostgreSQL 8.3, or older versions, want to understand exactly how the free space map works; people who are running PostgreSQL 8.4, or newer, don&amp;#39;t care.  It&amp;#39;s enough to know that it does work.&lt;br&gt;&lt;br&gt;Now, about eight months ago, I wrote a blog entry on &lt;a href="http://rhaas.blogspot.com/2011/03/troubleshooting-stuck-vacuums.html"&gt;troubleshooting stuck vacuums&lt;/a&gt;.  I would not say that this is an everyday problem, but in ten years of working with PostgreSQL, I&amp;#39;ve seen it a few times, and it&amp;#39;s very unpleasant.  It&amp;#39;s easy to miss the fact that you have a problem at all, because in most cases, nothing immediately breaks.  Instead, system performance just slowly degrades, gradually enough that you may not realize what the problem is until things have gotten pretty bad and you need to CLUSTER or VACUUM FULL to recover.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/11/unsticking-vacuum.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-5522648582512547739?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/5522648582512547739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=5522648582512547739' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5522648582512547739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5522648582512547739'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/11/unsticking-vacuum.html' title='Unsticking VACUUM'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-6420471033147264853</id><published>2011-11-07T09:55:00.001-05:00</published><updated>2011-11-07T21:33:54.975-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Hint Bits</title><content type='html'>Heikki Linnakangas was doing some benchmarking last week and discovered something surprising: in some circumstances, unlogged tables were actually slower than permanent tables.  Upon examination, he discovered that the problem was caused by CLOG contention, due to hint bits not being set soon enough.  This leads to a few questions:&lt;br&gt;&lt;br&gt;1. What is CLOG?&lt;br&gt;2. What are hint bits?&lt;br&gt;3. How does setting hint bits prevent CLOG contention?&lt;br&gt;4. Why weren&amp;#39;t hint bits being set sooner?&lt;br&gt;&lt;br&gt;Let&amp;#39;s take those in order.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/11/hint-bits.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-6420471033147264853?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/6420471033147264853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=6420471033147264853' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6420471033147264853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6420471033147264853'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/11/hint-bits.html' title='Hint Bits'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4468296093643051368</id><published>2011-10-31T09:17:00.001-04:00</published><updated>2011-10-31T09:17:23.867-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><category scheme='http://www.blogger.com/atom/ns#' term='index-only'/><title type='text'>Fast Counting</title><content type='html'>Since I wrote my &lt;a href="http://rhaas.blogspot.com/2011/10/index-only-scans-weve-got-em.html"&gt;previous blog entry on index-only scans&lt;/a&gt;, quite a bit of additional work has been done.  Tom Lane cleaned up the code and improved the costing model, but possibly the most interesting thing he did was to &lt;a href="http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=600d3206d1b3f8b540397b79905486a536ac7f78"&gt;allow index-only scans to be used for queries that don&amp;#39;t involve an indexable condition at all&lt;/a&gt;.  The classic example is SELECT COUNT(*) FROM table.  In previous versions of PostgreSQL, there&amp;#39;s just one way to implement this: sequential scan the table and count &amp;#39;em up.  In PostgreSQL 9.2, that method will still, of course, be available, but now there will be another choice: pick any index you like and do a full index scan, checking whether each tuple is all-visible either using the visibility map or via a heap fetch.  So, how well does it work?&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/10/fast-counting.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4468296093643051368?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4468296093643051368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4468296093643051368' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4468296093643051368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4468296093643051368'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/10/fast-counting.html' title='Fast Counting'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-7846290875482416728</id><published>2011-10-24T08:58:00.000-04:00</published><updated>2011-10-24T08:58:11.179-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>PostgreSQL Crash Debugging</title><content type='html'>As I mentioned in a &lt;a href="http://rhaas.blogspot.com/2011/04/change-of-role.html"&gt;previous blog post&lt;/a&gt;, I spend some of my time working in and with EnterpriseDB&amp;#39;s support department.  And what that means is that every customer I talk to has a problem, typically a fairly serious problem, and they want  me to help them fix it.  Of course, to fix it, you first have to be able to identify the problem, and sometimes that&amp;#39;s not so simple.  Database crashes can be among the more difficult cases to debug.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/10/postgresql-crash-debugging.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-7846290875482416728?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/7846290875482416728/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=7846290875482416728' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/7846290875482416728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/7846290875482416728'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/10/postgresql-crash-debugging.html' title='PostgreSQL Crash Debugging'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4891148720184106929</id><published>2011-10-17T10:16:00.002-04:00</published><updated>2011-10-17T10:18:25.959-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Deadlocks</title><content type='html'>Last week, someone pinged me on instant messenger to ask about the following message, which their &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; instance had just produced:&lt;br&gt;&lt;br&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;DETAIL: Process 22986 waits for ShareLock on transaction 939; blocked by process 22959.&lt;br&gt;Process 22959 waits for ShareLock on transaction 940; blocked by process 22986.&lt;/div&gt;&lt;br&gt;This message is a complaining about a deadlock.  But unless you&amp;#39;ve seen and debugged these a few times before, it might not be entirely obvious to you what&amp;#39;s actually going on here.  What, exactly, did the offending processes do that caused the problem?&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/10/deadlocks.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4891148720184106929?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4891148720184106929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4891148720184106929' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4891148720184106929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4891148720184106929'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/10/deadlocks.html' title='Deadlocks'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4873253042229225441</id><published>2011-10-07T21:09:00.001-04:00</published><updated>2011-10-31T09:17:44.493-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><category scheme='http://www.blogger.com/atom/ns#' term='index-only'/><title type='text'>Index-Only Scans: We've Got 'Em</title><content type='html'>Tom Lane &lt;a href="http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=a2822fb9337a21f98ac4ce850bb4145acf47ca27"&gt;committed&lt;/a&gt; a patch for index-only scans by myself and Ibrar Ahmed, which also incorporated some previous work by Heikki Linnakangas, after hacking on it some more himself.  Woohoo!&lt;br /&gt;&lt;br /&gt;There is, of course, more work to be done here - performance fine-tuning, cost estimation, extensions to the core functionality - but the core of the feature is now in.&amp;nbsp; If you get a chance, please test it out and let us know how it works for you.&lt;br /&gt;&lt;br /&gt;For those that may not have been &lt;a href="http://rhaas.blogspot.com/2010/11/index-only-scans.html"&gt;following&lt;/a&gt; &lt;a href="http://rhaas.blogspot.com/2011/08/index-only-scans-now-theres-patch.html"&gt;along&lt;/a&gt; at home, what we're essentially doing here is allowing any index to act as a "covering index".&amp;nbsp; If all of the columns the query needs are available from the index tuple, we'll skip fetching the corresponding heap (table) page if every tuple on that page is visible to all running transactions.&lt;br /&gt;&lt;br /&gt;Although I know we're not even really done with this feature yet, I can't help wondering what's next.&amp;nbsp; Index-only scans have so often be cited as "the big performance feature that PostgreSQL is missing" that it's become something of a cliché.&amp;nbsp; Now that we have them, what will take their place as the next big thing?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4873253042229225441?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4873253042229225441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4873253042229225441' title='21 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4873253042229225441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4873253042229225441'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/10/index-only-scans-weve-got-em.html' title='Index-Only Scans: We&apos;ve Got &apos;Em'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>21</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-2579814492059293368</id><published>2011-10-04T16:11:00.001-04:00</published><updated>2011-10-04T16:12:39.501-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>CommitFest In Progress</title><content type='html'>I&amp;#39;ve seen a lot of articles lately about the &lt;a href="http://it.toolbox.com/blogs/database-soup/the-innovative-elephant-48367"&gt;great new features&lt;/a&gt; (and &lt;a href="http://blog.2ndquadrant.com/en/2011/09/limitations-removed-in-postgre.html"&gt;removed limitations&lt;/a&gt;) in &lt;a href="http://www.postgresql.org/about/news.1349"&gt;PostgreSQL 9.1&lt;/a&gt;.  Unless you&amp;#39;re a regular reader of &lt;a href="http://archives.postgresql.org/pgsql-hackers/"&gt;pgsql-hackers&lt;/a&gt;, you could almost forget about the fact that PostgreSQL 9.2 development is in full swing.  In fact, there&amp;#39;s a &lt;a href="http://wiki.postgresql.org/wiki/CommitFest"&gt;CommitFest&lt;/a&gt; going on &lt;a href="https://commitfest.postgresql.org/action/commitfest_view?id=11"&gt;right now&lt;/a&gt; and &lt;a href="http://archives.postgresql.org/pgsql-rrreviewers/2011-09/msg00003.php"&gt;we could use a few more reviewers&lt;/a&gt;.&lt;br&gt;&lt;br&gt;Many of the features that were submitted to this CommitFest are small improvements - minor fine-tuning of existing features, like &lt;a href="http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=5ec6b7f1b87f0fa006b8e08a11cd4e99bcb67358"&gt;generating better column names for subquery expressions&lt;/a&gt;, or &lt;a href="http://archives.postgresql.org/pgsql-hackers/2011-09/msg01098.php"&gt;fixing things so that LIKE can more reliably make use of indexes when non-English characters are involved&lt;/a&gt;.  But some of the big features that will hopefully become part of PostgreSQL 9.2 are also beginning to materialize.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/10/commitfest-in-progress.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-2579814492059293368?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/2579814492059293368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=2579814492059293368' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2579814492059293368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2579814492059293368'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/10/commitfest-in-progress.html' title='CommitFest In Progress'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-251806318400197937</id><published>2011-09-30T14:36:00.001-04:00</published><updated>2011-10-04T11:06:46.076-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='surge'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Scalability, in Graphical Form, Analyzed</title><content type='html'>I&amp;#39;m at &lt;a href="http://omniti.com/surge/2011"&gt;Surge&lt;/a&gt;, this week, where I just listened to &lt;a href="http://www.xaprb.com/"&gt;Baron Schwartz&lt;/a&gt; give a talk about scalability and performance.  As usual, Baron was careful to distinguish between performance (which is how fast it is) and scalability (which is how much faster you can make it by adding more resources).  One of the things Baron talked about was &lt;a href="http://en.wikipedia.org/wiki/Neil_J._Gunther#Universal_Law_of_Computational_Scalability"&gt;Neil Guenther&amp;#39;s Universal Scalability Law&lt;/a&gt;, which attempts to model the behavior of complex systems (such as database systems) as you add threads, or nodes, or users.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/09/scalability-in-graphical-form-analyzed.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-251806318400197937?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/251806318400197937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=251806318400197937' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/251806318400197937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/251806318400197937'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/09/scalability-in-graphical-form-analyzed.html' title='Scalability, in Graphical Form, Analyzed'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-2Ft63JuwHO8/ToXX4zw2X8I/AAAAAAAAAEs/l3i3ESLPhWU/s72-c/read-scaling.png' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4583589040954667886</id><published>2011-09-20T16:14:00.001-04:00</published><updated>2011-09-20T17:28:24.472-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Postgres Open, and What Makes a Good Talk</title><content type='html'>My last few blog posts have been all about scalability and performance, mostly because that&amp;#39;s what I&amp;#39;ve been spending most of my time on these last few months.  But I&amp;#39;m pleased to have another subject: &lt;a href="http://postgresopen.org/2011/home/"&gt;Postgres Open&lt;/a&gt;.  I&amp;#39;ve been going to &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; conferences for a few years now, but Postgres Open - which is a new conference this year - was my first experience being on the program committee.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/09/postgres-open-and-what-makes-good-talk.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4583589040954667886?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4583589040954667886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4583589040954667886' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4583589040954667886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4583589040954667886'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/09/postgres-open-and-what-makes-good-talk.html' title='Postgres Open, and What Makes a Good Talk'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-921798792040100320</id><published>2011-08-18T16:00:00.001-04:00</published><updated>2011-10-31T09:18:14.346-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><category scheme='http://www.blogger.com/atom/ns#' term='index-only'/><title type='text'>Index-Only Scans: Now There's a Patch</title><content type='html'>In November of 2010, I blogged about a much-requested PostgreSQL feature: &lt;a href="http://rhaas.blogspot.com/2010/11/index-only-scans.html"&gt;index-only scans&lt;/a&gt;.  We&amp;#39;ve made some progress!  In June of this year, I &lt;a href="http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=503c7305a1e379f95649eef1a694d0c1dbdc674a"&gt;committed a patch&lt;/a&gt; (and then, after Heikki found some bugs, &lt;a href="http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=e16954f3d27fa8e16c379ff6623ae18d6250a39c"&gt;another patch&lt;/a&gt;) to make the visibility map crash-safe.  In previous releases, it was possible for the visibility map to become incorrect after a system crash, which means that it could not be relied on for anything very critical.  That should be fixed now.  Last week, I &lt;a href="http://archives.postgresql.org/pgsql-hackers/2011-08/msg00545.php"&gt;posted a patch&lt;/a&gt; for the main feature: index-only scans.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/08/index-only-scans-now-theres-patch.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-921798792040100320?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/921798792040100320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=921798792040100320' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/921798792040100320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/921798792040100320'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/08/index-only-scans-now-theres-patch.html' title='Index-Only Scans: Now There&apos;s a Patch'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-5025841095602433529</id><published>2011-08-04T15:39:00.001-04:00</published><updated>2011-08-05T06:41:57.636-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='glibc'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Linux and glibc Scalability</title><content type='html'>As some of you probably already know from following the traffic on pgsql-hackers, I&amp;#39;ve been continuing to beat away at the scalability issues around PostgreSQL.  Interestingly, the last two problems I found turned out, somewhat unexpectedly, not to be internal bottlenecks in PostgreSQL.  Instead, they were bottlenecks with other software with which PostgreSQL was interacting during the test runs.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/08/linux-and-glibc-scalability.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-5025841095602433529?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/5025841095602433529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=5025841095602433529' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5025841095602433529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5025841095602433529'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/08/linux-and-glibc-scalability.html' title='Linux and glibc Scalability'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4714323639082021557</id><published>2011-07-25T21:31:00.000-04:00</published><updated>2011-07-25T21:31:46.952-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>More On Read Scaling</title><content type='html'>In my previous blog post on &lt;a href="http://rhaas.blogspot.com/2011/07/read-scaling-out-to-32-cores.html"&gt;read scaling out to 32 cores&lt;/a&gt;, I wrote a patch I recently committed to improve read scalability in PostgreSQL.  It turns out, however, that there&amp;#39;s a downside to that patch, which was uncovered in testing by Stefan Kaltenbrunner.  (Fortunately, I have a fix.)  And, there&amp;#39;s an opportunity for further performance improvement by applying a similar technique to an additional type of lock.  For full details, read on.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/07/more-on-read-scaling.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4714323639082021557?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4714323639082021557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4714323639082021557' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4714323639082021557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4714323639082021557'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/07/more-on-read-scaling.html' title='More On Read Scaling'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-6325258185764023949</id><published>2011-07-21T10:33:00.001-04:00</published><updated>2011-07-21T10:33:42.672-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Read Scaling Out to 32 Cores</title><content type='html'>With the exception of a week&amp;#39;s vacation, my last month has been mostly absorbed by &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; performance work.  Specifically, I&amp;#39;ve been looking at the workload generated by &amp;quot;pgbench -S&amp;quot;, which essentially fires off lots and lots of SELECT queries that all do primary key lookups against a single table.  Even more specifically, I&amp;#39;ve been looking at the way this workload performs on systems with many CPU cores where (I found) PostgreSQL was not able to use all of the available CPU time to answer queries. Although the single-core performance was around 4,300 tps, performance with 36 clients (on a 24-core server) &lt;a href="http://archives.postgresql.org/message-id/BANLkTimVboKxzGS9BhL7XphBCr4iy-s0BQ@mail.gmail.com"&gt;was only about 36,000 tps&lt;/a&gt;.&lt;br&gt;&lt;br&gt;Research revealed that performance was being limited mostly by PostgreSQL&amp;#39;s lock manager.  Each SELECT query needed to lock the table being queried - and its index - against a concurrent DROP operation.   Since PostgreSQL 8.2, the lock manager has been partitioned: a lock request against a database object will be assigned to one of 16 &amp;quot;partitions&amp;quot;, and lock requests against objects that fall into different partitions can proceed in parallel.  Unfortunately, that doesn&amp;#39;t help much in this case, because only two objects are being locked: the table, and its index.  Most of the traffic therefore targets just two of the sixteen lock manager partitions.  Furthermore, because the query itself is so trivial, the rate of lock and unlock requests is extremely high - on a more complex query, the bottleneck wouldn&amp;#39;t be as severe.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/07/read-scaling-out-to-32-cores.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-6325258185764023949?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/6325258185764023949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=6325258185764023949' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6325258185764023949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6325258185764023949'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/07/read-scaling-out-to-32-cores.html' title='Read Scaling Out to 32 Cores'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-2052801107207174193</id><published>2011-06-13T15:15:00.000-04:00</published><updated>2011-06-13T15:15:16.860-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>False Contention</title><content type='html'>For the last few weeks, I've been buried in PostgreSQL performance analysis, mostly focusing on the workload generated by "pgbench -S" under high concurrency.&amp;nbsp; In other words, lots and lots of very simple SELECT statements on a single table.&amp;nbsp; Such workloads can generate serious internal contention within PostgreSQL on systems within many CPU cores.&lt;br /&gt;&lt;br /&gt;But it's interesting to note that most of the contention points I've so far identified are what might be called "false contention".&amp;nbsp; The transactions generated by this workload need to perform operations such as:&lt;br /&gt;&lt;br /&gt;- acquire an AccessShareLock on the target relation and its index to guard against a concurrent drop or schema change&lt;br /&gt;- acquire an ExclusiveLock on their VXID in case another transaction wishes to wait for transaction end&lt;br /&gt;- read the list of pending "invalidation" events, which are generally created by DDL&lt;br /&gt;- read the list of in-progress XIDs, to generate a snapshot&lt;br /&gt;- find the root index block for the table's primary key index in the shared buffer pool&lt;br /&gt;- momentarily pin the block containing the root index page into the buffer pool, so that it can't be evicted while we're examining it&lt;br /&gt;- momentarily lock the root index page, so that no new items can be added until we've decided which downlink to follow&lt;br /&gt;&lt;br /&gt;Now, in fact, in this workload, there is no concurrent DDL against the relevant table and index, or any other one; no one is attempting to wait for the completion of any VXID; the list of in-progress XIDs can easily be simultaneously read by many backends; and the root index page is in no danger either of being modified or of being evicted.&amp;nbsp; In short, the problem is not that there are resource conflicts, but that verifying that no resource conflicts exist is itself eating up too many resources.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-2052801107207174193?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/2052801107207174193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=2052801107207174193' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2052801107207174193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2052801107207174193'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/06/false-contention.html' title='False Contention'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-176374130451591295</id><published>2011-06-06T08:46:00.000-04:00</published><updated>2011-06-06T08:46:59.440-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Reducing Lock Contention</title><content type='html'>In a recent blog post on &lt;a href="http://rhaas.blogspot.com/2011/05/performance-optimization.html"&gt;Performance Optimization&lt;/a&gt;, I mentioned that Noah Misch and I had discussed some methods of reducing the overhead of frequent relation locks.  Every transaction that touches a given table or index locks it and, at commit time, unlocks it.  This adds up to a lot of locking and unlocking, which ends up being very significant on machines with many CPU cores.  I ended up spending a good chunk of last week hacking on this problem, with very promising results: I have &lt;a href="http://archives.postgresql.org/pgsql-hackers/2011-06/msg00225.php"&gt;a prototype patch&lt;/a&gt; that improves throughput on a SELECT-only pgbench test by about 3.5x on a system with 24 cores.  Not bad for a couple days work.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/06/reducing-lock-contention.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-176374130451591295?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/176374130451591295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=176374130451591295' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/176374130451591295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/176374130451591295'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/06/reducing-lock-contention.html' title='Reducing Lock Contention'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-248446624163809811</id><published>2011-05-27T13:48:00.000-04:00</published><updated>2011-05-27T13:48:40.940-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Open Source Licensing</title><content type='html'>I can&amp;#39;t resist the opportunity to comment on the FSF&amp;#39;s guidelines - apparently just published - for &lt;a href="http://www.gnu.org/licenses/license-recommendations.html"&gt;how to choose a license for your work&lt;/a&gt;.  A story on this was &lt;a href="http://yro.slashdot.org/story/11/05/26/2225227/FSF-On-How-To-Choose-a-License"&gt;posted on Slashdot&lt;/a&gt; this morning.  The FSF&amp;#39;s guidelines are a little more nuanced than they could be; for example, they recommend contributing code to existing projects under the licenses used by those projects, rather than starting a giant war with the maintainers of those projects.  And if you&amp;#39;re including trivial test programs in your work, or your work is shorter than the text of the GPL itself, you might just want to put the work in the public domain.  Very sensible!&lt;br&gt;&lt;br&gt;But that&amp;#39;s about as far as they&amp;#39;re willing to go.  For example, the section on contributing to existing projects suggests that, if you&amp;#39;re making major enhancements to a non-GPL program, you might want to fork it and release your changes under the GPL.  In other words, in the FSF&amp;#39;s opinion, sometimes you &lt;b&gt;should&lt;/b&gt; start a giant war with the maintainers.  In the open source world, forks are a part of life, and people are free to choose the licenses they want, but this seems awfully cavalier to me.  Forks are really damaging.  Maintaining a large and unified developer community has value; having those people spend their time developing, rather than arguing about licensing, is a good thing.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/05/open-source-licensing.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-248446624163809811?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/248446624163809811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=248446624163809811' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/248446624163809811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/248446624163809811'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/05/open-source-licensing.html' title='Open Source Licensing'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-159209088422111654</id><published>2011-05-26T09:55:00.001-04:00</published><updated>2011-05-26T09:55:37.051-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Performance Optimization</title><content type='html'>There have been several lively discussions this week on possible performance optimizations for PostgreSQL 9.2.  PostgreSQL 9.1 is still in beta, and there&amp;#39;s still plenty of bug-fixing going on there, but the number of people who need to and can be involved in that process is not as large as it was a month or two ago.  So it&amp;#39;s a good time to start thinking about development for PostgreSQL 9.2.  Not a lot of code is being written yet, which is probably just right for where we are in the development cycle, but we&amp;#39;re kicking the tires of various ideas and trying to figure out what projects are worth spending time on.  Here are a few that I&amp;#39;m excited about right now.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/05/performance-optimization.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-159209088422111654?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/159209088422111654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=159209088422111654' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/159209088422111654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/159209088422111654'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/05/performance-optimization.html' title='Performance Optimization'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-3288155264787004563</id><published>2011-05-23T12:22:00.000-04:00</published><updated>2011-05-23T12:22:09.257-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>PostgreSQL 9.2 Development: CommitFest Managers Needed</title><content type='html'>There&amp;#39;s an old joke that project managers don&amp;#39;t know how to do anything; they only know how to do it better.  Of course, the project manager is the butt of the joke: how can you know how to do something better, if you don&amp;#39;t know how to do it in the first place?&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/05/postgresql-92-development-commitfest.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-3288155264787004563?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/3288155264787004563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=3288155264787004563' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/3288155264787004563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/3288155264787004563'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/05/postgresql-92-development-commitfest.html' title='PostgreSQL 9.2 Development: CommitFest Managers Needed'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-508533297012210298</id><published>2011-05-11T21:48:00.000-04:00</published><updated>2011-05-13T16:40:13.666-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>PostgreSQL 9.1 In Review</title><content type='html'>As the &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; 9.1 development cycle winds down to a close (we&amp;#39;re now &lt;a href="http://www.postgresql.org/about/news.1313"&gt;in beta&lt;/a&gt;), I find myself reflecting on what we got done during this development cycle, and what we didn&amp;#39;t get done.  Just over a year ago, I published a blog post entitled &lt;a href="http://rhaas.blogspot.com/2010/05/big-ideas.html"&gt;Big Ideas&lt;/a&gt;, basically asking for feedback on what we should attempt to tackle in PostgreSQL 9.1.  The feedback was overwhelming, and led to a &lt;a href="http://rhaas.blogspot.com/2010/05/lots-and-lots-of-postgresql-feature.html"&gt;follow-on blog post&lt;/a&gt; summarizing the most-requested features.  Here&amp;#39;s the short version: Of the 10 or 11 most requested features, we implemented (drum roll, please) one.  Credit for granular collation support goes to Peter Eisentraut, with much additional hackery by Tom Lane.&lt;br&gt;&lt;br&gt;You can find a second list of possible 9.1 features in the minutes of the &lt;a href="http://wiki.postgresql.org/wiki/PgCon_2010_Developer_Meeting"&gt;PGCon 2010 Developer Meeting&lt;/a&gt;.  Of the 30 features listed there, we got, by my count, 12.5, or more than 40%.  While even that may seem like a somewhat small percentage, a dozen or so major enhancements to the development process is nothing to sneeze at.  And certainly, if you were a feature longing to be implemented, you&amp;#39;d much prefer to be on the second list than the first.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/05/postgresql-91-in-review.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-508533297012210298?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/508533297012210298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=508533297012210298' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/508533297012210298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/508533297012210298'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/05/postgresql-91-in-review.html' title='PostgreSQL 9.1 In Review'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-5247197449300935536</id><published>2011-05-05T14:20:00.000-04:00</published><updated>2011-05-05T14:20:55.679-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>shared_buffers on 32-bit systems</title><content type='html'>Every once in a while, I read something that's so obvious after the fact that I wonder why I didn't think of it myself.&amp;nbsp; A &lt;a href="http://archives.postgresql.org/pgsql-performance/2011-04/msg00296.php"&gt;recent thread&lt;/a&gt; on &lt;a href="http://archives.postgresql.org/pgsql-performance/"&gt;pgsql-performance&lt;/a&gt; had that effect.&amp;nbsp; The &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; &lt;a href="http://www.postgresql.org/docs/current/static/"&gt;documentation&lt;/a&gt; gives some rough guidelines for &lt;a href="http://www.postgresql.org/docs/current/static/runtime-config-resource.html#GUC-SHARED-BUFFERS"&gt;tuning shared_buffers&lt;/a&gt;, which recommends (on UNIX-like systems) 25% of system memory up to a maximum of 8GB. There are similar guidelines on the PostgreSQL wiki page, in the article on &lt;a href="http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server#shared_buffers"&gt;Tuning Your PostgreSQL Server&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;What became obvious to me in reading the thread - and probably should have been obvious to me all along - is that this advice only makes sense if you're running a 64-bit build of PostgreSQL, because, on a 32-bit build, each process is limited to 4GB of address space, of which (at least on Linux) 1GB is reserved for the kernel.&amp;nbsp; That means that no matter how much physical memory the machine has, each PostgreSQL backend will be able to address at most 3GB of data.&amp;nbsp; That includes (most significantly) shared_buffers, but also the process executable text, stack, and heap, including backend-local memory allocations for sorting and hashing, various internal caches that each backend process uses, local buffers for accessing temporary relations, and so on.&amp;nbsp; And 3GB is really a theoretical upper limit, if everything is packed optimally into the available address space: I'm not sure how close you can get to that limit in practice before things start breaking.&lt;br /&gt;&lt;br /&gt;So, if you're running a 32-bit PostgreSQL on UNIX-like operating system, you probably need to limit shared_buffers to at most 2GB or 2.5GB.&amp;nbsp; If that is less than about 25% of your system memory, you should seriously consider an upgrade to a 64-bit PostgreSQL.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-5247197449300935536?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/5247197449300935536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=5247197449300935536' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5247197449300935536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5247197449300935536'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/05/sharedbuffers-on-32-bit-systems.html' title='shared_buffers on 32-bit systems'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-2784694068979093868</id><published>2011-04-26T14:19:00.000-04:00</published><updated>2011-04-26T14:19:09.215-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>A Change of Role</title><content type='html'>I&amp;#39;m pleased to report that I have changed roles within &lt;a href="http://enterprisedb.com/"&gt;EnterpriseDB&lt;/a&gt; and am now officially a member of EnterpriseDB&amp;#39;s support and professional services team.  I have a number of other responsibilities as well, so I will not be spending all of my time on support, but I have been and will continue to spend a significant chunk of time on it each day.  When I&amp;#39;ve talked about this with people, they sometimes look at me as if I have two heads.  After all, I am a backend server developer, and developers as a breed are not known for enjoying support.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/04/change-of-role.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-2784694068979093868?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/2784694068979093868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=2784694068979093868' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2784694068979093868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2784694068979093868'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/04/change-of-role.html' title='A Change of Role'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-451852298481098217</id><published>2011-04-19T14:17:00.001-04:00</published><updated>2011-04-20T12:41:14.844-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>PostgreSQL East, and The MySQL Conference and Expo</title><content type='html'>Last month, I attended (and &lt;a href="https://www.postgresqlconference.org/content/postgresql-query-planner-1"&gt;spoke&lt;/a&gt; &lt;a href="https://www.postgresqlconference.org/content/introduction-write-ahead-logging"&gt;at&lt;/a&gt;) &lt;a href="https://www.postgresqlconference.org/2011/east/"&gt;PostgreSQL East&lt;/a&gt; in New York City, which this year featured a MongoDB track.&amp;nbsp; This past week, I was in Santa Clara at the &lt;a href="http://en.oreilly.com/mysql2011"&gt;O'Reilly MySQL Conference &amp;amp; Expo&lt;/a&gt;, which had a substantial PostgreSQL track this year, where &lt;a href="http://en.oreilly.com/mysql2011/public/schedule/detail/17342"&gt;I also spoke&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Both conferences had some very good talks.&amp;nbsp; The first talk I attended at the MySQL conference turned out to be one of the best - it was entitled &lt;a href="http://en.oreilly.com/mysql2011/public/schedule/detail/17111"&gt;Linux and H/W optimizations for MySQL&lt;/a&gt;.&amp;nbsp; I had a little difficulty understanding Yoshinori Matsunobu's accent at times, but the slides were excellent, and very detailed.&amp;nbsp; Some of his more interesting findings: (1) SSDs speed things up both on the master and on replication slaves, but the speedup is larger on the slaves; so it's useful to put hard disks on the master and SSDs on the slave to make it possible for single-threaded recovery there to keep up with the master; (2) while SSDs are much faster for random access, they are actually slower for sequential access and fsync, so a RAID array with a battery-backed or flash-backed write cache may still be a better option in those cases, (3) Fusion I/O drives were FAR faster than Intel drives, (4) the Intel Nehalem architecture was much faster than the AMD Opteron architecture when used in combination with SSDs, and (5) HyperThreading helps more in SSD environments than it does otherwise, because the system, overall, becomes more heavily CPU-bound; for the same reasons, mutex contention hurts more.&lt;br /&gt;&lt;br /&gt;Another very good talk was Peter Zaitsev's discussion of &lt;a href="http://en.oreilly.com/mysql2011/public/schedule/detail/17637"&gt;Innodb and XtraDB Architecture and Performance Optimization&lt;/a&gt;, which gave me the feeling of looking into a sort of carnival mirror, where you recognize yourself, but it's all distorted.&amp;nbsp; Two of the problems that give PostgreSQL DBAs heartburn - bloat, and checkpoint I/O spikes (and less frequently, purge not keeping up a la vacuum not keeping up) - are apparently problems for MySQL as well, though with significantly different details.&amp;nbsp; I'm not even going to attempt to summarize the differences, or say which problem is worse or occurs more often, because I honestly have no idea.&amp;nbsp; I was a bit surprised to hear dump-and-reload recommended to recover from certain worst-case scenarios, though.&lt;br /&gt;&lt;br /&gt;There were other good talks, too, which helped me understand what's going on in the world of MySQL forks.&amp;nbsp; Apparently, the Drizzle team is busy removing features that they consider half-baked and modularizing the code so that it is easier to understand and improve, while the MariaDB team is busy adding optimizer features, including support for hash joins and persistent statistics.&amp;nbsp; From what I understand, the MySQL optimizer has typically worked by gathering statistics through on-the-fly index probes, which can be a problem in some situations.&amp;nbsp; It's not so easy to categorize the work that Oracle is doing, but it seems to involve a fair amount of filing down of rough edges, and various improvements to replication, including, perhaps most significantly, parallel replication apply.&lt;br /&gt;&lt;br /&gt;At PostgreSQL East, I think my favorite talk was Ken Rosensteel's talk, somewhat misleadingly titled &lt;a href="http://www.bullservices.com/large-customers-want-postgresql-too/739/"&gt;Large Customers Want PostgreSQL, Too&lt;/a&gt;.&amp;nbsp; This talk turned to be about migrating a large Oracle mainframe application to use PostgreSQL, and the challenges faced during that migration.&amp;nbsp; He, or his team, built an Oracle-to-PostgreSQL converter for stored procedures; it was interesting to see that they got bitten by our bizarre casting rules around the smallint data type.&amp;nbsp; They also ended up doing some very interesting work optimizing the performance of ECPG for small FETCH statements; these are areas of the code that I think don't normally get a lot of attention, and it was great to hear about the optimization work that got done.&lt;br /&gt;&lt;br /&gt;I was disappointed that Jon Hoffman's talk on Experiences with &lt;a href="https://www.postgresqlconference.org/content/experiences-postgres-and-mongodb-foursquarecom"&gt;Postgres and MongoDB at foursquare.com&lt;/a&gt; got cancelled; I think that would have been an interesting talk.&amp;nbsp; I did have an opportunity to attend Jake Luciani's talk &lt;a href="https://www.postgresqlconference.org/content/comparing-apache-cassandra-architecture-postgresql"&gt;Comparing the Apache Cassandra Architecutre to PostgreSQL&lt;/a&gt;, which turned out to be more about Cassandra than PostgreSQL, but was nevertheless interesting.&amp;nbsp; I would have been interested to hear a more technical talk, though, about how problems like &lt;a href="http://rhaas.blogspot.com/2010/07/distributed-serialization-anomalies.html"&gt;distributed serialization anomalies&lt;/a&gt; and distributed checkpointing are handled.&lt;br /&gt;&lt;br /&gt;Next month, I'll be speaking at &lt;a href="http://www.pgcon.org/2011/"&gt;PGCon 2011&lt;/a&gt; on &lt;a href="http://www.pgcon.org/2011/schedule/events/305.en.html"&gt;Using The PostgreSQL System Catalogs&lt;/a&gt; and &lt;a href="http://www.pgcon.org/2011/schedule/events/303.en.html"&gt;How To Get Your PostgreSQL Patch Accepted&lt;/a&gt;.&amp;nbsp; And after that, &lt;a href="http://momjian.us/main/blogs/pgblog/2011.html#April_5_2011"&gt;unlike Bruce&lt;/a&gt;, I'm going to stay home for a few months!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-451852298481098217?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/451852298481098217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=451852298481098217' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/451852298481098217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/451852298481098217'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/04/postgresql-east-and-mysql-conference.html' title='PostgreSQL East, and The MySQL Conference and Expo'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-197360736177810893</id><published>2011-04-07T06:00:00.002-04:00</published><updated>2011-04-08T00:29:07.831-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>One-Way Tuning</title><content type='html'>I've been noticing that many of the parameters in postgresql.conf only ever need to be adjusted in one direction from the default.&lt;br /&gt;&lt;br /&gt;shared_buffers, temp_buffers, work_mem, maintenance_work_mem,&amp;nbsp; checkpoint_segments, checkpoint_timeout, and checkpoint_completion_target, join_collapse_limit, and from_collapse_limit only ever need to be adjusted upward from the default.&lt;br /&gt;&lt;br /&gt;bgwriter_delay, seq_page_cost, and random_page_cost only ever need to be adjusted downward from the default.&lt;br /&gt;&lt;br /&gt;Does this mean we should change some of the defaults?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-197360736177810893?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/197360736177810893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=197360736177810893' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/197360736177810893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/197360736177810893'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/04/one-way-tuning.html' title='One-Way Tuning'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-5937791434356590296</id><published>2011-03-31T22:06:00.000-04:00</published><updated>2011-03-31T22:06:03.310-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>CommitFests and Meritocracy</title><content type='html'>Yesterday, I wrote a blog post on whether and to what extend the &lt;a href="http://www.postgresql.org/community/"&gt;PostgreSQL community&lt;/a&gt; is a &lt;a href="http://rhaas.blogspot.com/2011/03/welcoming-community.html"&gt;welcoming community&lt;/a&gt;, in which I quoted some remarks that Selena Deckelmann made, and she responded with her own post on &lt;a href="http://www.chesnok.com/daily/2011/03/30/where-meritocracy-fails/"&gt;where meritocracy fails&lt;/a&gt;.  I want to just recap a few things that may not be totally obvious to casual observers of our community; and then I have a few remarks about meritocracy.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/03/commitfests-and-meritocracy.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-5937791434356590296?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/5937791434356590296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=5937791434356590296' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5937791434356590296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5937791434356590296'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/03/commitfests-and-meritocracy.html' title='CommitFests and Meritocracy'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1733110744679046840</id><published>2011-03-30T16:38:00.001-04:00</published><updated>2011-03-30T22:44:10.452-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>A Welcoming Community?</title><content type='html'>I attended &lt;a href="https://www.postgresqlconference.org/2011/east/"&gt;PostgreSQL East&lt;/a&gt; last week and, as usual, the most interesting discussions were the ones that nobody planned.  Ed Boyajian, the CEO here at &lt;a href="http://enterprisedb.com/"&gt;EnterpriseDB&lt;/a&gt; where I work, threw out a remark to the effect that the PostgreSQL community is a meritocracy.  Selena Deckelmann &lt;a href="http://twitter.com/#%21/selenamarie/status/50586220211867648"&gt;wasn&amp;#39;t convinced&lt;/a&gt;, &amp;quot;&lt;a href="http://twitter.com/#%21/selenamarie/status/50587393920729088"&gt;not to say that we don&amp;#39;t do try hard, and do pretty well&lt;/a&gt;.&amp;quot;  During the closing session, Josh Drake made some remarks to the effect that, in effect, the process for &lt;a href="http://wiki.postgresql.org/wiki/Submitting_a_Patch"&gt;submitting a patch&lt;/a&gt; to &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; is long, difficult, and fraught with arbitrary and capricious rejection, which caused me to rise to my feet and object that that while it&amp;#39;s not perfect, I think we do pretty well, and better than we used to.  Josh agreed with some of what I have to say, and I see his point, too.  But it got me thinking about the whole way that we operate as a development community, and what is good and bad about it.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/03/welcoming-community.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1733110744679046840?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1733110744679046840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1733110744679046840' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1733110744679046840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1733110744679046840'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/03/welcoming-community.html' title='A Welcoming Community?'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-549641903828724093</id><published>2011-03-21T10:36:00.000-04:00</published><updated>2011-03-21T10:36:11.621-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Working Toward PostgreSQL 9.1beta</title><content type='html'>I'm pleased to report that we seem to be making good progress toward PostgreSQL 9.1beta.&amp;nbsp; As we did for PostgreSQL 9.0, we are maintaining a &lt;a href="http://wiki.postgresql.org/wiki/PostgreSQL_9.1_Open_Items"&gt;list of open items&lt;/a&gt; that we need either to address or to decide that they aren't so important after all (there are also some issues that are being discussed on the mailing list that aren't reflected in that open items list).&amp;nbsp; What we're really doing here is trying to stabilize the code, particularly with respect to the features committed at the very end of the development cycle.&amp;nbsp; So far, the main problem areas appear to be (1) collation support, (2) changes to streaming replication, especially the new synchronous replication feature, and (3) the new serializable isolation level.&amp;nbsp; But we are making rapid progress in sorting out the loose ends, and I feel a lot better about the release now than I did even a week ago.&lt;br /&gt;&lt;br /&gt;Barring objections or unforeseen problems, I'm hoping to bundle an alpha5 release a week from today, on Monday, March 28.&amp;nbsp; We haven't discussed the time line for beta yet, other than to hope that we'll be able to get there in April.&amp;nbsp; I still think that's a realistic timeline, although there is quite a bit of work that must be done between now and then for us to hit it.&amp;nbsp; In the meantime, if you're in a position to build from source, please &lt;a href="http://wiki.postgresql.org/wiki/HowToBetaTest"&gt;keep testing&lt;/a&gt; and sending in &lt;a href="http://archives.postgresql.org/pgsql-bugs/"&gt;bug reports&lt;/a&gt;.&amp;nbsp; Thanks!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-549641903828724093?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/549641903828724093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=549641903828724093' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/549641903828724093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/549641903828724093'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/03/working-toward-postgresql-91beta.html' title='Working Toward PostgreSQL 9.1beta'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4920602286502010021</id><published>2011-03-16T16:45:00.000-04:00</published><updated>2011-03-16T16:45:26.670-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Query Planner Enhancements in PostgreSQL 9.1</title><content type='html'>PostgreSQL has an &lt;b&gt;awesome&lt;/b&gt; query planner.  And it keeps getting better.  &lt;a href="http://postgresql.org/"&gt;postgresql.org&lt;/a&gt; has a survey asking people &lt;a href="http://www.postgresql.org/community/survey.78"&gt;Which PostgreSQL 9.1 Feature Are You Most Excited About?&lt;/a&gt; (to vote on it, if it&amp;#39;s still open when you read this, &lt;a href="http://www.postgresql.org/community/"&gt;go here&lt;/a&gt;).  For some reason, query planner features tend not to be listed when people talk about what they&amp;#39;re most excited about in a new release, but there&amp;#39;s ample room for excitement.  If a particular query planner feature happens to apply to your use case, it&amp;#39;s possible to see multiple-order-of-magnitude speedups, avoiding the need for a major application redesign or even an expensive hardware purchase.  This is a big deal.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/03/query-planner-enhancements-in.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4920602286502010021?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4920602286502010021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4920602286502010021' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4920602286502010021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4920602286502010021'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/03/query-planner-enhancements-in.html' title='Query Planner Enhancements in PostgreSQL 9.1'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-6981503190021658316</id><published>2011-03-10T13:12:00.004-05:00</published><updated>2011-03-10T13:28:29.121-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='google'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Advice for Google Summer of Code Students (and other prospective contributors)</title><content type='html'>Periodically, someone whose name I&amp;#39;ve ever seen before contacts me -- or posts to &lt;a href="http://archives.postgresql.org/pgsql-hackers/"&gt;pgsql-hackers&lt;/a&gt; -- to say that either (1) they&amp;#39;ve already written a great patch for PostgreSQL and they&amp;#39;d like to know how to get it committed or (2) they&amp;#39;re interested in writing a patch to implement some major new feature in &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt;.  Some of these people are prospective &lt;a href="http://code.google.com/soc/"&gt;Google Summer of Code&lt;/a&gt; students, while others are researchers or other people who, for whatever reason, are interested in PostgreSQL.  I am always thrilled to see more people take an interest in PostgreSQL, but unfortunately I&amp;#39;ve seen a number of people who seemed very smart and promising crash and burn when in terms of actually making a successful contribution of code.  In fact, no matter how promising things seem at the outset, the failure rate - in my experience - is very close to 100%. &lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/03/advice-for-google-summer-of-code.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-6981503190021658316?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/6981503190021658316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=6981503190021658316' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6981503190021658316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6981503190021658316'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/03/advice-for-google-summer-of-code.html' title='Advice for Google Summer of Code Students (and other prospective contributors)'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-3510774910547700592</id><published>2011-03-03T13:07:00.001-05:00</published><updated>2011-03-03T13:08:10.554-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>More Musings on Logical Replication</title><content type='html'>There were some interesting comments on my &lt;a href="http://rhaas.blogspot.com/2011/02/case-for-logical-replication.html"&gt;previous blog post on logical replication&lt;/a&gt;, which have inspired me to write a bit more about this topic.  Exactly how should this actually work?  Every time a tuple is inserted, updated, or deleted, we already write to the transaction log the entire contents of any new tuple, and the physical position of any old tuple.  It would be nice to piggyback somehow on the work that&amp;#39;s already being done there, but it&amp;#39;s hard to see exactly how.  I see three main problems.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/03/more-musings-on-logical-replication.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-3510774910547700592?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/3510774910547700592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=3510774910547700592' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/3510774910547700592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/3510774910547700592'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/03/more-musings-on-logical-replication.html' title='More Musings on Logical Replication'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-6714697268167828259</id><published>2011-03-01T10:04:00.001-05:00</published><updated>2011-03-01T10:05:04.728-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Troubleshooting Stuck VACUUMs</title><content type='html'>Over the years, I&amp;#39;ve occasionally encountered situations where VACUUM fails to make progress, and not fully understood why that was happening.  Recently, I&amp;#39;ve come to a better understanding of how lock conflicts can result in VACUUM stalling out either at the beginning of the table, or part-way through.  (If you&amp;#39;re not already familiar with the types of locks that PostgreSQL uses, you may find it helpful to read through my earlier blog post on &lt;a href="http://rhaas.blogspot.com/2011/01/locking-in-postgresql.html"&gt;locking in PostgreSQL&lt;/a&gt; before reading on.)&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/03/troubleshooting-stuck-vacuums.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-6714697268167828259?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/6714697268167828259/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=6714697268167828259' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6714697268167828259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6714697268167828259'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/03/troubleshooting-stuck-vacuums.html' title='Troubleshooting Stuck VACUUMs'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1456606912627192755</id><published>2011-02-26T07:30:00.000-05:00</published><updated>2011-02-26T07:30:00.532-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>The Case For Logical Replication</title><content type='html'>Replication, as it exists in &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; today, is physical replication.  That is, the disk files as they exist on the standby are essentially byte-for-byte identical to the ones on the master (with the exception that the same hint bits may not be set).  When a change is made on the master, the write-ahead log is streamed to the standby, which makes the same change to the corresponding disk block on the standby.  The alternative is logical replication, in which what is transferred is not an instruction to write a certain sequence of bytes at a certain location, but the information that a certain tuple was inserted, or that a table with a given schema was created.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/02/case-for-logical-replication.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1456606912627192755?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1456606912627192755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1456606912627192755' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1456606912627192755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1456606912627192755'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/02/case-for-logical-replication.html' title='The Case For Logical Replication'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1777322409922766086</id><published>2011-02-17T12:40:00.002-05:00</published><updated>2011-02-17T12:41:14.541-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Working in the Community</title><content type='html'>The &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; community makes decisions by consensus.  The craziness of this approach should be readily apparent.  The United States Senate has come under withering criticism for rules which permit one or a small number of Senators to hold up the business of the chamber to such an extent that it&amp;#39;s difficult to get anything done.  Forty-one senators can filibuster just about anything, to the frustration of the fifty-nine who want to have a vote and get on with it; and sometimes just one Senator can make himself or herself a near-complete obstacle to progress.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/02/working-in-community.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1777322409922766086?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1777322409922766086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1777322409922766086' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1777322409922766086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1777322409922766086'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/02/working-in-community.html' title='Working in the Community'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-5224866883744886037</id><published>2011-02-17T09:23:00.002-05:00</published><updated>2011-02-17T11:03:54.389-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Keeping Local Git Branches Up To Date</title><content type='html'>Because I spend most of my time working on the master branch of the &lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git"&gt;PostgreSQL git repository&lt;/a&gt;, I prefer to work with just a single clone.  The PostgreSQL wiki page &lt;a href="http://wiki.postgresql.org/wiki/Committing_with_Git"&gt;Committing with Git&lt;/a&gt; describes several ways of using multiple clones and/or git-new-workdir, but my personal preference is to just use one clone.  Most of the time, I keep the main branch checked out, but every once in a while I check out one of the back-branches to look at something, or to back-patch.  (If you&amp;#39;re unfamiliar with the PostgreSQL workflow, note that we do not merge into our official branches; we always rebase, so that there are no merge commits in our official repository.  You may or may not like this workflow, but it works for us.)&lt;br&gt;&lt;br&gt;One small annoyance is that &amp;quot;git pull&amp;quot; doesn&amp;#39;t leave my clone in the state I want.  Say I have the master branch checked out.  &amp;quot;git pull&amp;quot; will update all of my remote tracking branches, but it will only update the local branch that I currently have checked out.  This is annoying, first of all because if I later type &amp;quot;git log REL9_0_STABLE&amp;quot; I&amp;#39;ll only get the commits since the last time I checked out and pulled that branch, rather than as I intended the latest state of the upstream, and secondly because it leads to spurious griping when I later do &amp;quot;git push&amp;quot;: it complains that the old branches can&amp;#39;t be pushed because it wouldn&amp;#39;t be a fast-forward merge.  This is of course a little silly: since my branch tip is an ancestor of the tracking branch, it would be more reasonable to conclude that I haven&amp;#39;t updated it than to imagine I meant to clobber the origin.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/02/keeping-local-git-branches-up-to-date.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-5224866883744886037?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/5224866883744886037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=5224866883744886037' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5224866883744886037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5224866883744886037'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/02/keeping-local-git-branches-up-to-date.html' title='Keeping Local Git Branches Up To Date'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-3894785987764305435</id><published>2011-02-01T10:06:00.002-05:00</published><updated>2011-02-02T12:07:35.484-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>MySQL vs. PostgreSQL, Part 2: VACUUM vs. Purge</title><content type='html'>Almost two months ago, I wrote &lt;a href="http://rhaas.blogspot.com/2010/11/mysql-vs-postgresql-part-1-table.html"&gt;part one&lt;/a&gt; of what I indicated would be an occasional series of blog posts comparing the architecture of &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; to that of &lt;a href="http://www.mysql.com/"&gt;MySQL&lt;/a&gt;&lt;a href="http://www.postgresql.org/"&gt;&lt;/a&gt;.  Here&amp;#39;s part two.  Please note that the caveats set forth in part one apply to this and all future installments as well, so if you haven&amp;#39;t read part one already, please click on the link above and read at least the first two paragraphs before reading this post.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/02/mysql-vs-postgresql-part-2-vacuum-vs.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-3894785987764305435?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/3894785987764305435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=3894785987764305435' title='21 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/3894785987764305435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/3894785987764305435'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/02/mysql-vs-postgresql-part-2-vacuum-vs.html' title='MySQL vs. PostgreSQL, Part 2: VACUUM vs. Purge'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>21</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-2655130628135948601</id><published>2011-01-24T09:49:00.003-05:00</published><updated>2011-01-24T11:00:54.393-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>PostgreSQL 9.1: Neat Stuff is Coming</title><content type='html'>Up until the last month or so, the development arc for &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; 9.1 was looking fairly humdrum.   Quite a bit of good refactoring and some good general enhancements, but not a lot of sizzle.  That seems to be changing now.  Of course, in one sense, that&amp;#39;s a bad thing: we&amp;#39;re only three weeks from the end of the development cycle, and ideally it would have been nicer to have some of these big patches land just a little bit sooner.  Still, I feel pretty good about the quality of what&amp;#39;s been committed.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/01/postgresql-91-neat-stuff-is-coming.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-2655130628135948601?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/2655130628135948601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=2655130628135948601' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2655130628135948601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2655130628135948601'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/01/postgresql-91-neat-stuff-is-coming.html' title='PostgreSQL 9.1: Neat Stuff is Coming'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-8339568411780158922</id><published>2011-01-20T11:45:00.001-05:00</published><updated>2011-01-20T11:46:02.594-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Locking in PostgreSQL</title><content type='html'>Have you ever had one of those annoying problems where a query, or some kind of maintenance task such as vacuum, seems to hang, without making any discernable foreign progress, basically forever?  If it&amp;#39;s a foreground task, you typically think to yourself &amp;quot;oh, that&amp;#39;s taking longer than normal&amp;quot; - but then you start to become suspicious as to whether anything&amp;#39;s happening at all.  You fire up top, or strace, or gdb, or iostat, or some combination of those tools, and eventually decide that, indeed, nothing is happening.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/01/locking-in-postgresql.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-8339568411780158922?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/8339568411780158922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=8339568411780158922' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/8339568411780158922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/8339568411780158922'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/01/locking-in-postgresql.html' title='Locking in PostgreSQL'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1333052115698696027</id><published>2011-01-18T09:33:00.001-05:00</published><updated>2011-01-18T09:34:22.228-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>What Kind of Replication Do You Need?</title><content type='html'>As you probably know by now if you&amp;#39;re a regular reader of &lt;a href="http://planet.postgresql.org/"&gt;Planet PostgreSQL&lt;/a&gt;, or if you&amp;#39;ve read the &lt;a href="http://www.postgresql.org/docs/9.0/static/release-9-0.html"&gt;PostgreSQL 9.0 release notes&lt;/a&gt;, PostgreSQL 9.0 offers a much-improved form of built-in replication.  In PostgreSQL 8.4 and prior releases, replication was possible via WAL shipping, but the delay between master and standby could be several minutes, or even longer, depending on configuration parameters.  This delay has been essentially eliminated in PostgreSQL 9.0, which allows the write-ahead log to be streamed from master to standby as it&amp;#39;s generated.&lt;br&gt;&lt;br&gt;But it&amp;#39;s still &lt;i&gt;asynchronous&lt;/i&gt; replication - as opposed synchronous replication, which has been &lt;a href="https://commitfest.postgresql.org/action/patch_view?id=511"&gt;proposed for inclusion in PostgreSQL 9.1&lt;/a&gt;.  If the master crashes just an instant after processing a COMMIT statement, the client will believe that the transaction has committed, but the slave won&amp;#39;t know about it.  If the slave is then promoted to become the new master, the transaction is gone forever.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/01/what-kind-of-replication-do-you-need.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1333052115698696027?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1333052115698696027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1333052115698696027' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1333052115698696027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1333052115698696027'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/01/what-kind-of-replication-do-you-need.html' title='What Kind of Replication Do You Need?'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-8572402700894217779</id><published>2011-01-14T13:57:00.000-05:00</published><updated>2011-01-14T13:57:40.610-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Why SQL/MED is Cool</title><content type='html'>One of the &lt;a href="http://rhaas.blogspot.com/2011/01/postgresql-91-big-patches.html"&gt;big patches&lt;/a&gt; that is in the works for PostgreSQL 9.1 -- and will hopefully but not for sure make the cut -- is a series of patches that implement basic SQL/MED functionality for PostgreSQL.   What is SQL/MED and why should you care?&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/01/why-sqlmed-is-cool.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-8572402700894217779?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/8572402700894217779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=8572402700894217779' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/8572402700894217779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/8572402700894217779'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/01/why-sqlmed-is-cool.html' title='Why SQL/MED is Cool'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-145498093279585567</id><published>2011-01-04T17:24:00.002-05:00</published><updated>2011-01-04T18:22:14.975-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>PostgreSQL 9.1: Big Patches</title><content type='html'>About three weeks ago, I wrote a &lt;a href="http://rhaas.blogspot.com/2010/12/crunch-time-for-postgresql-91.html"&gt;blog post about the forthcoming end of the PostgreSQL 9.1 development cycle&lt;/a&gt;, and the many large and important features for which we have patches outstanding.  Since we now have just 11 days to go before the beginning of the forth and final &lt;a href="https://commitfest.postgresql.org/"&gt;CommitFest&lt;/a&gt;, this seems like a good time to revisit the progress we&amp;#39;ve made.  Here again is the list of features from my previous post:&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2011/01/postgresql-91-big-patches.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-145498093279585567?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/145498093279585567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=145498093279585567' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/145498093279585567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/145498093279585567'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2011/01/postgresql-91-big-patches.html' title='PostgreSQL 9.1: Big Patches'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1949612055337423709</id><published>2010-12-20T17:28:00.000-05:00</published><updated>2010-12-20T17:28:11.454-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='microsoft'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>PostgreSQL Performance vs. Microsoft SQL Server</title><content type='html'>A recent poster to the &lt;a href="http://archives.postgresql.org/pgsql-performance/"&gt;pgsql-performance&lt;/a&gt; mailing list enquired as to the relative performance of Microsoft SQL Server vs. PostgreSQL.  It&amp;#39;s a reasonable question.  Switching databases can be a major project, and you certainly wouldn&amp;#39;t want to do it and then find out at the end that you&amp;#39;d taken a huge performance hit and had to throw all your work away and switch back.  The good news is that this scenario is fairly unlikely.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/12/postgresql-performance-vs-microsoft-sql.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1949612055337423709?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1949612055337423709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1949612055337423709' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1949612055337423709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1949612055337423709'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/12/postgresql-performance-vs-microsoft-sql.html' title='PostgreSQL Performance vs. Microsoft SQL Server'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1246441081592438225</id><published>2010-12-16T08:52:00.003-05:00</published><updated>2010-12-16T21:54:38.994-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Two Hundred Commits</title><content type='html'>My first patch (&lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=a0b76dc662efde6e02921c2d16e06418483b7534"&gt;add a separate TRUNCATE privilege&lt;/a&gt;) was committed to the &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; source code repository (at the time, CVS) by Tom Lane on September 8, 2008.  I became a committer a little over a year later, and the first commit I did myself was on December 10, 2009 (a patch from Marcin Mank to &lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=da07641481bcad3d21f6d7cee0690a1c75f89c54"&gt;fix levenshtein_with_costs&lt;/a&gt;).  Of course, I screwed it up: the release team was in the middle of wrapping a minor release, and I back-patched the fix in the brief window after the release notes were written and before the release went out.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/12/two-hundred-commits.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1246441081592438225?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1246441081592438225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1246441081592438225' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1246441081592438225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1246441081592438225'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/12/two-hundred-commits.html' title='Two Hundred Commits'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4268693390622615498</id><published>2010-12-15T18:03:00.000-05:00</published><updated>2010-12-15T18:03:42.765-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='selinux'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>SE-Linux for PostgreSQL: Part 3</title><content type='html'>Back in September, I wrote two blog posts on SE-Linux integration for PostgreSQL.  In &lt;a href="http://rhaas.blogspot.com/2010/09/se-linux-for-postgresql-part-1.html"&gt;part 1&lt;/a&gt;, I discussed the work that had already been committed as of that time.  In &lt;a href="http://rhaas.blogspot.com/2010/09/se-linux-for-postgresql-part-2.html"&gt;part 2&lt;/a&gt;, I discussed what I learned at the meeting, and planned next steps.  Since then, a considerable amount of progress has been made, so it seems like a good time to revisit the issue.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/12/se-linux-for-postgresql-part-3.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4268693390622615498?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4268693390622615498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4268693390622615498' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4268693390622615498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4268693390622615498'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/12/se-linux-for-postgresql-part-3.html' title='SE-Linux for PostgreSQL: Part 3'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4744119703921664291</id><published>2010-12-13T13:43:00.000-05:00</published><updated>2010-12-13T13:43:00.596-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Crunch Time for PostgreSQL 9.1</title><content type='html'>According to the &lt;a href="http://wiki.postgresql.org/wiki/PostgreSQL_9.1_Development_Plan"&gt;PostgreSQL 9.1 development plan&lt;/a&gt;, the final CommitFest for PostgreSQL 9.1 development will begin in 33 days.&amp;nbsp; Approximately 30 days later, we'll stamp our final alpha release and begin preparations for PostgreSQL 9.1 beta.&amp;nbsp; This is exciting news, because I'm really looking forward to PostgreSQL 9.1.&amp;nbsp; It's also scary news, because there is a lot of work left to be done between now and then, and at least in the United States, Christmas is going to take a bite out of that time.&lt;br /&gt;&lt;br /&gt;We have a number of very interesting, very significant features which were submitted to the &lt;a href="https://commitfest.postgresql.org/action/commitfest_view?id=8"&gt;2010-11 CommitFes&lt;/a&gt;t.&amp;nbsp; These include SQL/MED, extensions, synchronous replication, writeable CTEs, per-column collation, MERGE, checkpoint improvements, further infrastructure for SE-Linux integration, and my own work on unlogged tables.&amp;nbsp; While we've made significant progress on most of these features during this CommitFest, major work still remains to be done on nearly all of them, and none of them can be considered a sure thing for PostgreSQL 9.1.&amp;nbsp; It's possible - maybe even likely - that even more worthwhile features will be added to the queue between now and mid-January.&lt;br /&gt;&lt;br /&gt;So it's crunch time.&amp;nbsp; We have about two months to define what PostgreSQL 9.1 will be.&amp;nbsp; Let's make the most of it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4744119703921664291?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4744119703921664291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4744119703921664291' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4744119703921664291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4744119703921664291'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/12/crunch-time-for-postgresql-91.html' title='Crunch Time for PostgreSQL 9.1'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1645071460945059698</id><published>2010-12-06T22:20:00.000-05:00</published><updated>2010-12-06T22:20:27.962-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>The Cost of Page Faults</title><content type='html'>Over Thanksgiving, I wrote a bit about some work I did &lt;a href="http://rhaas.blogspot.com/2010/11/profiling-postgresql.html"&gt;profiling PostgreSQL&lt;/a&gt;, and about squeezing a bit of overhead out of the backend shutdown process.&amp;nbsp; After making that change, I did some further profiling of connection startup/tearddown, and was dismayed to see that &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-11/msg01632.php"&gt;the revised profile&lt;/a&gt; looked pretty mundane, with most of the time being taken up by functions like memset() and memcpy() that are typically hard to optimize.&lt;br /&gt;&lt;br /&gt;As it turns out, this profile wasn't really showing what I thought it was showing.&amp;nbsp; Andres Freund and Tom Lane theorized that the reason why memset() and memcpy() showed up so high in the profile was not because those operations were intrinsically expensive, but because those functions were triggering page faults.&amp;nbsp; Page faults occur when a process attempts to access a portion of its address space it hasn't previously touched, and the kernel must arrange to map that chunk of address space to an actual chunk of physical memory.&amp;nbsp; As it turns out, it appears that Andres and Tom were right: &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-11/msg01952.php"&gt;processing a page fault is 2 or 3 times more expensive than zeroing a page of memory&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I found this a bit surprising, because I'm in the habit of thinking of process startup on UNIX-like systems as being very cheap, but it appears that in this case there's so little actual work going on the page faults actually become the dominant cost.&amp;nbsp; This means that if we want to make a significant further reduction in our connection overhead, we're probably going to have to avoid starting a new process for each new connection.&amp;nbsp; I &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-12/msg00381.php"&gt;posted a few ideas on this topic&lt;/a&gt;, to which &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-12/msg00438.php"&gt;Tom Lane responded&lt;/a&gt;.&amp;nbsp; In short, there may be some benefit in making &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; follow a model more like &lt;a href="http://httpd.apache.org/"&gt;Apache&lt;/a&gt;, where workers are spawned before they are actually needed, rather than on demand.&amp;nbsp; I don't presently have time to follow up on this, but I think it's got potential.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1645071460945059698?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1645071460945059698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1645071460945059698' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1645071460945059698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1645071460945059698'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/12/cost-of-page-faults.html' title='The Cost of Page Faults'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4966168090782304337</id><published>2010-12-03T13:15:00.002-05:00</published><updated>2011-03-01T10:05:30.793-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Troubleshooting Database Unresponsiveness</title><content type='html'>From time to time, we get complaints on the &lt;a href="http://archives.postgresql.org/pgsql-performance/"&gt;pgsql-performance&lt;/a&gt; mailing list about a &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; database that - for the most part - performs reasonably well, but every once in a while it becomes unresponsive for some number of seconds or even minutes; and then eventually recovers.  What&amp;#39;s going on?&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/12/troubleshooting-database.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4966168090782304337?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4966168090782304337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4966168090782304337' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4966168090782304337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4966168090782304337'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/12/troubleshooting-database.html' title='Troubleshooting Database Unresponsiveness'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-5925549755303054273</id><published>2010-11-29T16:37:00.001-05:00</published><updated>2011-03-10T13:49:41.886-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>MySQL vs. PostgreSQL, Part 1: Table Organization</title><content type='html'>I&amp;#39;m going to be starting an occasional series of blog postings comparing MySQL&amp;#39;s architecture to PostgreSQL&amp;#39;s architecture.  Regular readers of this blog will already be aware that I know PostgreSQL far better than MySQL, having last used MySQL a very long time ago when both products were far less mature than they are today.  So, my discussion of how PostgreSQL works will be based on first-hand knowledge, but discussion of how MySQL works will be based on research and - insofar as I&amp;#39;m can make it happen - discussion with people who know it better than I do.  (Note: If you&amp;#39;re a person who knows MySQL better than I do and would like to help me avoid making stupid mistakes, drop me an email.)&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/11/mysql-vs-postgresql-part-1-table.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-5925549755303054273?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/5925549755303054273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=5925549755303054273' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5925549755303054273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5925549755303054273'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/11/mysql-vs-postgresql-part-1-table.html' title='MySQL vs. PostgreSQL, Part 1: Table Organization'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4190152049842424586</id><published>2010-11-25T09:09:00.000-05:00</published><updated>2010-11-25T09:09:13.679-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Profiling PostgreSQL</title><content type='html'>I did a little bit of work Tuesday night and Wednesday profiling &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt;.&amp;nbsp; I ran two different tests.&amp;nbsp; The first test was designed just to measure the overhead of &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-11/msg01582.php"&gt;repeatedly connecting to the database without doing anything&lt;/a&gt;, while the second test looked &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-11/msg01643.php"&gt;running pgbench with 36 concurrent threads&lt;/a&gt;.&amp;nbsp; The best thing that can happen to you when you fire up the profiler is to have something pop up the profile that you never would have expected.&amp;nbsp; At least in my experience, when you see what you expect to see, that typically means it's something you've already thought about optimizing, and is therefore probably reasonably efficient already.&amp;nbsp; When you see something totally unexpected, it's probably something you've never thought about optimizing, and of course the first optimization is always the easiest.&lt;br /&gt;&lt;br /&gt;Anyhow, that's what happened to me with the "repeated connections" test.&amp;nbsp; It turns out that a big chunk of the CPU time was actually being spent during backend exit, rather than (as I had anticipated) backend startup.&amp;nbsp; We had a check in there to forcibly release any buffer pins that hadn't been cleaned up properly during normal execution.&amp;nbsp; Originally, this was probably a necessary and valuable check, but we've subsequently added much more thorough and robust cleanup mechanisms which should mean that this code never finds anything to release.&amp;nbsp; If it does find something, gracefully cleaning up the pin is the wrong idea: we want the code to yell and scream, so that we find and fix the underlying bug.&lt;br /&gt;&lt;br /&gt;So, after some &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-11/msg01612.php"&gt;discussion&lt;/a&gt; &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-11/msg01620.php"&gt;with&lt;/a&gt; &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-11/msg01625.php"&gt;Tom&lt;/a&gt; &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-11/msg01639.php"&gt;Lane&lt;/a&gt;, I &lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=c2281ac87cf4828b6b828dc8585a10aeb3a176e0"&gt;ripped this code out&lt;/a&gt; and replaced it with some code that will run only in assert-enabled builds (which are typically used only for development and debugging) that will check for leftover buffer pins and fail an assertion if any are found, which will hopefully make it easier to find any current or future bugs in this area.&amp;nbsp; In non-assert-enabled builds, we no longer do anything at all here (the best kind of optimization!).&lt;br /&gt;&lt;br /&gt;Unfortunately, this was the only really surprising thing that popped up in the profiling results.&amp;nbsp; Further improvements are going to take a bit more work.&lt;br /&gt;&lt;br /&gt;Happy Thanksgiving!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4190152049842424586?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4190152049842424586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4190152049842424586' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4190152049842424586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4190152049842424586'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/11/profiling-postgresql.html' title='Profiling PostgreSQL'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-606492814630767275</id><published>2010-11-22T11:21:00.002-05:00</published><updated>2011-10-31T09:19:02.196-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><category scheme='http://www.blogger.com/atom/ns#' term='index-only'/><title type='text'>Index-Only Scans</title><content type='html'>There seems to be a lot of interest in the as-yet-unimplemented performance feature called index-only scans, so I thought it would be useful to explain a little bit more about what this feature is, how it will help PostgreSQL, and where the bodies are buried.&lt;br&gt;&lt;br&gt;First, the name.  What do we mean by an index-only scan?  In PostgreSQL today, an index scan always accesses both the index itself and the underlying table.  You might think this unnecessary.  For example, if you have the query SELECT name FROM table WHERE id = 10, and there is an index on (id, name), you might assume that we could use the index to check for tuples with id = 10, and the if one is found, return the name directly from the index tuple, without consulting the underlying table.  Unfortunately, this does not work, because that tuple might not actually be one that the SELECT statement can see.  If the tuple was inserted by a transaction which began after the SELECT statement took its MVCC snapshot, or deleted by a transaction which committed before the SELECT statement took its MVCC snapshot, then the SELECT statement must not return it.  If it did, we would quickly get very surprising wrong answers out of the database.  So PostgreSQL first looks at the index tuple, and then the heap (table) tuple, decides what the right thing to do is, and does it.  By an index ONLY scan, we mean one which will look at just the index, and not at the corresponding table; the trick is to figure out how to make that happen without returning wrong answers.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/11/index-only-scans.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-606492814630767275?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/606492814630767275/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=606492814630767275' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/606492814630767275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/606492814630767275'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/11/index-only-scans.html' title='Index-Only Scans'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4964027766157074769</id><published>2010-11-18T09:39:00.003-05:00</published><updated>2010-11-18T10:25:03.025-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Best Patches of 9.1CF3</title><content type='html'>Back in July, I wrote a blog post on the &lt;a href="http://rhaas.blogspot.com/2010/07/best-patches-of-91cf1.html"&gt;best patches submitted for the first CommitFest for PostgreSQL 9.1 development&lt;/a&gt; (so far, the first two out of the three have been committed).  I didn&amp;#39;t end up writing a similar post for the second CommitFest, because there wasn&amp;#39;t a lot of stuff that really grabbed my attention, but the third CommitFest is here now, and there are a ton of exciting patches.&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/11/best-patches-of-91cf3.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4964027766157074769?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4964027766157074769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4964027766157074769' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4964027766157074769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4964027766157074769'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/11/best-patches-of-91cf3.html' title='Best Patches of 9.1CF3'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1324116606563158605</id><published>2010-11-17T00:14:00.002-05:00</published><updated>2010-11-18T08:55:52.609-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>When Your Data Isn't Made of Gold</title><content type='html'>Josh Berkus&amp;#39; recent blog posting on &lt;a href="http://it.toolbox.com/blogs/database-soup/what-we-should-be-learning-from-mysql-part-2-42540"&gt;What We Should Be Learning from MySQL, part 2&lt;/a&gt; includes the following quote: &amp;quot;We tend to treat all data in Postgres as if it were made of gold, and not all data is equally valuable.&amp;quot;  He goes on to wonder what we can do to better provide for the case where your data isn&amp;#39;t made of gold.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/11/when-your-data-isnt-made-of-gold.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1324116606563158605?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1324116606563158605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1324116606563158605' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1324116606563158605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1324116606563158605'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/11/when-your-data-isnt-made-of-gold.html' title='When Your Data Isn&apos;t Made of Gold'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-6330562123412755964</id><published>2010-11-10T22:04:00.002-05:00</published><updated>2010-11-10T23:37:50.090-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Rob Wultsch's MySQL Talk at PostgreSQL West</title><content type='html'>I thought &lt;a href="https://www.postgresqlconference.org/content/mysql-elephant-room"&gt;this talk&lt;/a&gt; deserved a blog post of its own, so here it is.  I have to admit that I approach this topic with some trepidation.  The MySQL vs. PostgreSQL debate is one of those things that people get touchy about.  Still, I&amp;#39;m pleased that not only Rob, but a number of other MySQL community members who I did not get a chance to meet, came to the conference, and it sounds like it will be our community&amp;#39;s turn to visit &lt;a href="http://en.oreilly.com/mysql2011/"&gt;their conference&lt;/a&gt; in April of next year.  Rob was kind enough to offer to introduce me to some of the MySQL community members who were there, and I, well, I didn&amp;#39;t take him up on it.  That&amp;#39;s something I&amp;#39;d like to rectify down the road, but unfortunately this was a very compressed trip for me, and the number of people I had time to talk to and meet with was much less than what I would have liked.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/11/rob-wultschs-mysql-talk-at-postgresql.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-6330562123412755964?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/6330562123412755964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=6330562123412755964' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6330562123412755964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6330562123412755964'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/11/rob-wultschs-mysql-talk-at-postgresql.html' title='Rob Wultsch&apos;s MySQL Talk at PostgreSQL West'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4607916792183637924</id><published>2010-11-08T14:23:00.000-05:00</published><updated>2010-11-08T14:23:39.791-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>PostgreSQL West Talks</title><content type='html'>As I &lt;a href="http://rhaas.blogspot.com/2010/10/here-comes-postgresql-west.html"&gt;blogged about before the conference&lt;/a&gt;, I gave two talks this year at &lt;a href="https://www.postgresqlconference.org/2010/west/"&gt;PostgreSQL West&lt;/a&gt;.&amp;nbsp; The first was a talk on the query optimizer, which I've given before, and the second talk was on using the system catalogs, which was new.&amp;nbsp; While the second one was well-attended, the first one was packed.&amp;nbsp; I keep hoping I'll think of something to talk about that people find even more interesting than the query planner, but so far no luck.&amp;nbsp; &lt;a href="https://sites.google.com/site/robertmhaas/presentations"&gt;Slides for both presentations are now posted&lt;/a&gt;; I've added two slides to the system catalogs presentation that weren't there when I gave the talk, but probably should have been.&lt;br /&gt;&lt;br /&gt;Nearly all the talks I attended were good.&amp;nbsp; Some of the best were Greg Smith's talk on &lt;a href="https://www.postgresqlconference.org/content/righting-your-writes"&gt;Righting Your Writes&lt;/a&gt; (&lt;a href="http://projects.2ndquadrant.com/talks"&gt;slides&lt;/a&gt;), Gabrielle Roth's talk on &lt;a href="https://www.postgresqlconference.org/content/survey-postgresql-monitoring-tools"&gt;PostgreSQL monitoring tools&lt;/a&gt;, and Joe Conway's talk on &lt;a href="https://www.postgresqlconference.org/content/building-open-geospatial-analysis-technology-stack"&gt;Building an Open Geospatial Technology Stack&lt;/a&gt; (which was actually given in part by Jeff Hamann, who has a &lt;a href="http://www.forestinformatics.com/about.htm"&gt;company&lt;/a&gt;, and a &lt;a href="http://www.amazon.com/Forest-Analytics-Introduction-Andrew-Robinson/dp/1441977619"&gt;book&lt;/a&gt;).&amp;nbsp; All three of these, and a number of the others, were rich with the sort of anecdotal information that it's hard to get out of the documentation: How exactly do you set this up? How well does it actually work?&amp;nbsp; What are its best and worst points?&lt;br /&gt;&lt;br /&gt;Another memorable talk was Rob Wultsch's talk entitled "&lt;a href="https://www.postgresqlconference.org/content/mysql-elephant-room"&gt;MySQL: The Elephant in the Room&lt;/a&gt;".&amp;nbsp; But that talk really deserves a blog post all of its own.&amp;nbsp; Stay tuned.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4607916792183637924?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4607916792183637924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4607916792183637924' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4607916792183637924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4607916792183637924'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/11/postgresql-west-talks.html' title='PostgreSQL West Talks'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-6489318271582224332</id><published>2010-10-28T13:50:00.001-04:00</published><updated>2010-10-28T13:50:15.410-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Here Comes PostgreSQL West</title><content type='html'>In just a few days, I&amp;#39;ll be off to &lt;a href="https://www.postgresqlconference.org/2010/west"&gt;PostgreSQL West&lt;/a&gt;.  I&amp;#39;ve attended &lt;a href="https://www.postgresqlconference.org/2010/east/"&gt;PostgreSQL East&lt;/a&gt; and &lt;a href="http://www.pgcon.org/"&gt;PGCon&lt;/a&gt; both of the last two years, but this will be my first trip out to PG West.  As with past conferences, this will be a good opportunity for me to catch up with people I normally speak with only via the Internet.  But, there&amp;#39;s something that&amp;#39;s a little different about this one.  Take a look at &lt;a href="https://www.postgresqlconference.org/2010/west/agenda"&gt;the agenda&lt;/a&gt;.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/10/here-comes-postgresql-west.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-6489318271582224332?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/6489318271582224332/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=6489318271582224332' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6489318271582224332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6489318271582224332'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/10/here-comes-postgresql-west.html' title='Here Comes PostgreSQL West'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1746903707120345424</id><published>2010-10-25T10:36:00.000-04:00</published><updated>2010-10-25T10:36:23.811-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>WAL Reliability</title><content type='html'>I recently learned, somewhat to my chagrin, that operating systems are pathological liars, and in particular that they habitually lie about whether data has actually been written to disk.  If you use any database product, you should care about this, because it can result in unfixable, and in some cases undetected, corruption of your database.  First, a question.  On which of the following operating systems do fsync() and related calls behave properly out of the box?&lt;br&gt;&lt;br&gt;A. Linux&lt;br&gt;B. Windows&lt;br&gt;C. MacOS&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/10/wal-reliability.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1746903707120345424?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1746903707120345424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1746903707120345424' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1746903707120345424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1746903707120345424'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/10/wal-reliability.html' title='WAL Reliability'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-9020189442541285742</id><published>2010-10-14T15:30:00.003-04:00</published><updated>2010-10-14T16:11:03.905-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='nosql'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Choosing a Datastore</title><content type='html'>In thinking about which database might be best for any particular job, it&amp;#39;s easy to get lost in the PR. Advocates of  traditional relational database systems like &lt;a href="http://www.oracle.com/us/products/database/index.html"&gt;Oracle&lt;/a&gt; and &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; tend  to focus on the fact that systems are feature-rich and provide features  such as atomicity, consistency, isolation, and durability (&lt;a href="http://en.wikipedia.org/wiki/ACID"&gt;ACID&lt;/a&gt;), while  advocates of document databases (like &lt;a href="http://www.mongodb.org/"&gt;MongoDB&lt;/a&gt;) and key-value stores  (&lt;a href="http://memcached.org/"&gt;memcached&lt;/a&gt;, &lt;a href="http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html"&gt;Dynamo&lt;/a&gt;, &lt;a href="http://www.basho.com/Riak.html"&gt;Riak&lt;/a&gt;, and many others) tend to focus on performance,  horizontal scalability, and ease of configuration.  This is obviously an apples-and-oranges comparison, and a good deal of misunderstanding and finger-pointing can result.  Of course, the real situation is a bit more complicated: everyone really wants to have all of these features, and any trade-off between them is bound to be difficult.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/10/choosing-datastore.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-9020189442541285742?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/9020189442541285742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=9020189442541285742' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/9020189442541285742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/9020189442541285742'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/10/choosing-datastore.html' title='Choosing a Datastore'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-7879392881063126761</id><published>2010-10-06T23:27:00.001-04:00</published><updated>2010-10-15T09:08:26.278-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Down To Six</title><content type='html'>From early July until the beginning of this week, the &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; project has been maintaining &lt;b&gt;eight&lt;/b&gt; active branches: 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, and the master branch (9.1devel).   As a result, a significant number of bug fixes and security updates had to be &lt;a href="http://rhaas.blogspot.com/2010/08/why-were-conservative-with-postgresql.html"&gt;back-patched into all of those releases&lt;/a&gt;.  At least for me, the recent &lt;a href="http://rhaas.blogspot.com/2010/09/enjoying-git.html"&gt;switch to git&lt;/a&gt; has made back-patching, at least for simple cases, a whole lot simpler.  But it&amp;#39;s still a fair amount of work - some parts of the code have changed a good deal since 2003, when 7.4 was released.&lt;br&gt;&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/10/down-to-six.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-7879392881063126761?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/7879392881063126761/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=7879392881063126761' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/7879392881063126761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/7879392881063126761'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/10/down-to-six.html' title='Down To Six'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-5170349420430591892</id><published>2010-10-04T23:34:00.003-04:00</published><updated>2010-10-15T09:09:59.335-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='surge'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>SURGE Recap</title><content type='html'>Bruce Momjian and I spent Thursday and Friday of last week in Baltimore, attending &lt;a href="http://omniti.com/surge/2010"&gt;Surge&lt;/a&gt;.  It was a great conference.  I think the best speakers were &lt;a href="http://en.wikipedia.org/wiki/Bryan_Cantrill"&gt;Bryan Cantrill&lt;/a&gt; of &lt;a href="http://www.joyent.com/"&gt;Joyent&lt;/a&gt; (@&lt;a href="http://twitter.com/bcantrill"&gt;bcantrill&lt;/a&gt;), John Allspaw of &lt;a href="http://www.etsy.com/"&gt;Etsy&lt;/a&gt; (@&lt;a href="http://twitter.com/allspaw"&gt;allspaw&lt;/a&gt;), and Artur Bergman of &lt;a href="http://www.wikia.com/Wikia"&gt;Wikia&lt;/a&gt; (@&lt;a href="http://twitter.com/crucially"&gt;crucially&lt;/a&gt;), but there were many other good talks as well.  The theme of the conference was scalability, and a number of speakers discussed how they&amp;#39;d tackled scalability challenges.  Most seem to have started out with an infrastructure based on &lt;a href="http://www.mysql.com/"&gt;MySQL&lt;/a&gt; or &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; and added other technologies around the core database to improve scalability, especially &lt;a href="http://lucene.apache.org/java/docs/index.html"&gt;Lucene&lt;/a&gt; and &lt;a href="http://memcached.org/"&gt;memcached&lt;/a&gt;.  But there were some interesting exceptions, such as a &lt;a href="http://omniti.com/surge/2010/speakers/mike-malone"&gt;talk by Mike Malone&lt;/a&gt; wherein he described building a system to manage spatial data (along the lines of &lt;a href="http://postgis.refractions.net/"&gt;PostGIS&lt;/a&gt;) on top of &lt;a href="http://cassandra.apache.org/"&gt;Apache Cassandra&lt;/a&gt;.&lt;br&gt;&lt;br&gt;Some general themes I took away from the conference:&lt;br&gt;&lt;a href="http://rhaas.blogspot.com/2010/10/surge-recap.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-5170349420430591892?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/5170349420430591892/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=5170349420430591892' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5170349420430591892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5170349420430591892'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/10/surge-recap.html' title='SURGE Recap'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-2870030472922551183</id><published>2010-09-28T13:17:00.000-04:00</published><updated>2010-09-28T13:17:13.876-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Stupid Git Tricks for PostgreSQL</title><content type='html'>Even before &lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=summary"&gt;PostgreSQL switched to git&lt;/a&gt;, we had a git mirror of our old CVS repository.&amp;nbsp; So I suppose I could have hacked up these scripts any time.&amp;nbsp; But I didn't get around to it until we really did the switch.&amp;nbsp; Here's the first one.&amp;nbsp; It's a one-liner.&amp;nbsp; For some definition of "one line".&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;git log --format='%H' --shortstat `git merge-base REL9_0_STABLE master`..master | perl -ne 'chomp; if (/^[0-9a-f]/) { print $_, " "; } elsif (/files changed/) { s/^\s+//; my @a = split /\s+/; print $a[3] + $a[5], "\n" }' | sort -k2 -n -r | head | cut -d' ' -f1 | while read commit; do git log --shortstat -n 1 $commit | cat; echo ""; done&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will show you the ten "biggest" commits since the REL9_0_STABLE branch was created, according to number of lines of code touched.&amp;nbsp; Of course, this isn't a great proxy for significance, as the output shows.&amp;nbsp; Heavily abbreviated, largest first:&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=66424a284879b5e0d456a1c7c1ec06b0b918a798"&gt;66424a284879b&lt;/a&gt; Fix indentation of verbatim block elements (Peter Eisentraut)&lt;br /&gt;&lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=9f2e211386931f7aee48ffbc2fcaef1632d8329f"&gt;9f2e211386931&lt;/a&gt; Remove cvs keywords from all files (Magnus Hagander)&lt;br /&gt;&lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=4d355a8336e0f2265b31d678ffd1ee5cf9e79fae"&gt;4d355a8336e0f&lt;/a&gt; Add a SECURITY LABEL command (Robert Haas)&lt;br /&gt;&lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=c10575ff005c330d0475345621b7d381eb510c48"&gt;c10575ff005c3&lt;/a&gt; Rewrite comment code for better modular&lt;br /&gt;ity, and add necessary locking (Robert Haas)&lt;br /&gt;&lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=53e757689ce94520f1c53a89dbaa14ea57b09da7"&gt;53e757689ce94&lt;/a&gt; Make NestLoop plan nodes pass outer-relation variables into their inner relation using the general PARAM_EXEC executor parameter mechanism, rather than the ad-hoc kluge of passing the outer tuple down through ExecReScan (Tom Lane)&lt;br /&gt;&lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=5194b9d04988ae10b94b86ba5bc1110377079241"&gt;5194b9d04988a&lt;/a&gt; Spell and markup checking (Peter Eisentraut)&lt;br /&gt;&lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=005e427a22e3bb7fa01a84a7b476a3d6359a0344"&gt;005e427a22e3b&lt;/a&gt; Make an editorial pass over the 9.0 release notes. (Tom Lane)&lt;br /&gt;&lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=3186560f46b5076feb8776ae5e600b7ea0f31852"&gt;3186560f46b50&lt;/a&gt; Replace doc references to install-win32 with install-windows (Robert Haas)&lt;br /&gt;&lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=debcec7dc31a992703911a9953e299c8d730c778"&gt;debcec7dc31a9&lt;/a&gt; Include the backend ID in the relpath of temporary relations (Robert Haas)&lt;/div&gt;&lt;a href="http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=2746e5f21d4dce07ee55c58b2035ff631470577f" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;2746e5f21d4dc&lt;/a&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; Introduce latches. A latch is a boolean variable, with the capability to wait until it is set (Heikki Linnakangas)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Of course, some of these are not-very-interesting commits that happen to touch a lot of lines of code, but a number of them represented significant refactoring work that can be expected to lead to good things down the line.&amp;nbsp; In particular, latches are intended to reduce replication latency and eventually facilitate synchronous replication; and Tom's PARAM_EXEC refactoring is one step towards support for the SQL construct LATERAL().&lt;br /&gt;&lt;br /&gt;OK, one more.&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;BP=`git merge-base master REL9_0_STABLE`&lt;br /&gt;&lt;br /&gt;git log --format='format:%an' $BP..master | sort -u |&lt;br /&gt;while read author; do&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "$author: \c"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; git log --author="$author" --numstat $BP..master |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; awk '/^[0-9]/ { P += $1; M += $2 }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /^commit/ { C++ }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;END { print C " commits, " P " additions, " M " deletions, " (P+M) " total"}'&lt;br /&gt;done&lt;/div&gt;&lt;br /&gt;This one shows you the total number of lines of code committed to 9.1devel, summed up by committer.&amp;nbsp; It has the same problem as the previous script, which is that it sometimes you change a lot of lines of code without actually doing anything terribly important.&amp;nbsp; It has a further problem, too: it only takes into account the committer, rather other important roles, including reporter, authors, and reviewers.&amp;nbsp; Unfortunately, that information can't easily be extracted from the commit logs in a structured way.&amp;nbsp; I would like to see us address that defect in the future, but we're going to need something more clever than git's Author field.&amp;nbsp; Most non-trivial patches, in the form in which they are eventually committed, are the work of more than one person; and, at least IMO, crediting only the main author (if there even is one) would be misleading and unfair in many cases.&lt;br /&gt;&lt;br /&gt;I think the most interesting tidbit I learned from playing around with this stuff is that git merge-base can be used to find the branch point for a release.&amp;nbsp; That's definitely handy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-2870030472922551183?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/2870030472922551183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=2870030472922551183' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2870030472922551183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2870030472922551183'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/09/stupid-git-tricks-for-postgresql.html' title='Stupid Git Tricks for PostgreSQL'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-2943224563332054271</id><published>2010-09-24T09:35:00.000-04:00</published><updated>2010-09-24T09:35:07.474-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Enjoying Git</title><content type='html'>OK, I admit it.&amp;nbsp; This is awesome.&amp;nbsp; I'm still getting used to committing to &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; with &lt;a href="http://git-scm.com/"&gt;git&lt;/a&gt; rather than &lt;a href="http://www.nongnu.org/cvs/"&gt;CVS&lt;/a&gt;, but it's sort of like the feeling of being let out of the dungeon.&amp;nbsp; Wow, sunlight, what am I supposed to do about that?&lt;br /&gt;&lt;br /&gt;Actually, I've never really been into CVS bashing; it's an OK system for what it does.&amp;nbsp; And compare to RCS, which I actually used once or twice a long time ago, it's positively phenomenal.&amp;nbsp; But git, despite its imperfections, is just a lot better.&lt;br /&gt;&lt;br /&gt;There are two major things that caused problems for me when committing to CVS.&amp;nbsp; First, it was painfully slow.&amp;nbsp; Second, since I was doing all of my development work on git, that meant extracting the patch, applying it to CVS, making sure to CVS add/rm any new/deleted files, retyping (or copying) the commit message, and double-checking that I hadn't messed anything up while moving the patch around.&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;$ git commit&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; $ git show&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;$ git push&lt;/div&gt;&lt;br /&gt;Nice!&amp;nbsp; I feel like someone gave me an &lt;a href="http://www.staples.com/sbd/cre/marketing/easybutton/"&gt;easy button&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-2943224563332054271?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/2943224563332054271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=2943224563332054271' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2943224563332054271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2943224563332054271'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/09/enjoying-git.html' title='Enjoying Git'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-7511164377889869274</id><published>2010-09-18T01:01:00.000-04:00</published><updated>2010-09-18T01:01:56.833-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Git Conversion, Take Two</title><content type='html'>The &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; project will be making its &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-09/msg00969.php"&gt;second attempt to migrate from CVS to git&lt;/a&gt; this coming Monday.&amp;nbsp; In a &lt;a href="http://rhaas.blogspot.com/2010/09/so-why-isnt-postgresql-using-git-yet.html"&gt;previous blog post&lt;/a&gt;, I talked about some of the difficulties we've had getting a clean conversion of our project history to git.&amp;nbsp; I was surprised that a number of people suggested throwing out our development history and just moving the head of each branch to git; and I agree with some of the later comments that this would be a bad idea.&amp;nbsp; I refer back to our development history fairly frequently, for a variety of reasons: to determine when particular features were introduced, to determine what patch last touched a particular area of the code, to see how old a particular bit of code is, and sometimes even to model a new patch on a previous patch that added a similar feature.&amp;nbsp; So I'd find it very painful to lose convenient access to all of that history.&amp;nbsp; Even a somewhat messed-up conversion would be better than no conversion at all.&lt;br /&gt;&lt;br /&gt;Fortunately, it looks like we're going to end up with a pretty darn good conversion.&amp;nbsp; Tom Lane spent most of last weekend &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-09/msg00636.php"&gt;cleaning up most of the remaining infelicities&lt;/a&gt;.&amp;nbsp; The newest conversions are a huge improvement over both our current, incrementally-updated conversion (which is what I use for day to day development) as well as earlier attempts at a final conversion.&amp;nbsp; Only a handful of minor artifacts remain, mostly because of wacky things that were done in CVS many years ago.&amp;nbsp; Our use of CVS in recent years has been quite disciplined, which is why such a clean conversion is possible.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-7511164377889869274?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/7511164377889869274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=7511164377889869274' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/7511164377889869274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/7511164377889869274'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/09/git-conversion-take-two.html' title='Git Conversion, Take Two'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-8918941344563151176</id><published>2010-09-14T07:00:00.000-04:00</published><updated>2010-09-14T09:29:09.272-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='selinux'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>SE-Linux For PostgreSQL: Part 2</title><content type='html'>In &lt;a href="http://rhaas.blogspot.com/2010/09/se-linux-for-postgresql-part-1.html"&gt;part 1 of this blog post&lt;/a&gt;, I talked about my recent visit to &lt;a href="http://pugs.postgresql.org/bwpug"&gt;BWPUG&lt;/a&gt; to discuss &lt;a href="http://www.nsa.gov/research/selinux/"&gt;SE-Linux&lt;/a&gt; and &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt;, and reviewed the work that has been done so far, as well as a few upcoming patches.&amp;nbsp; In this second part of the post, I'm going to review what I learned at the meeting and where the SE-Linux folks told me they'd like to see us go with this.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;One of the most interesting concepts we discussed was the idea of a &lt;u&gt;type transition&lt;/u&gt;.&amp;nbsp; This may be old hat for experienced SE-Linux users, but it was a new idea for me.&amp;nbsp; I'm not sure that I understand this concept in its full generality, but Joshua Brindle explained two specific applications of it to me.&amp;nbsp; First, when objects are created, SE-Linux apparently allows the context of that object to depend not only on the context of the creator, but also on where the object was created.&amp;nbsp; For example, if Apache is running in a context called apache_t and creates a temporary file in /tmp, the context of the new file might be apache_tmp_t.&amp;nbsp; Similarly, if a PostgreSQL client creates a table, the SE-Linux folks would like to be able to determine the security label for the table based on a combination of the client's context and the containing schema's label.&lt;br /&gt;&lt;br /&gt;The second application of type transitions which we discussed in the meeting related to what KaiGai Kohei has been calling a &lt;a href="http://wiki.postgresql.org/wiki/SEPostgreSQL_Development#Trusted_Procedure"&gt;trusted procedure&lt;/a&gt;.&amp;nbsp; The idea here seems to be that when a certain function is executed, SE-Linux should have the option based on the user's context and the function's context to transition to a new security context for just the period of time during which the function is executing.&amp;nbsp; This doesn't involve a kernel call: it's just internal recordkeeping.&amp;nbsp; I'm imaging that SE-Linux support for PostgreSQL will be provided by a loadable module, so essentially we'd need a bullet-proof way of allowing the SE-Linux module to gain control briefly at function entry and exit time (and that would be certain to be called even if, say, we exit the function due to an error condition).&lt;br /&gt;&lt;br /&gt;We also talked about SE-Linux control of operations other than DML, which is what the ExecCheckRTPerms hook I talked about in part 1 of this posting will support.&amp;nbsp; In particular, Joshua Brindle and David Quigley were very concerned about proper control over the LOAD statement.&amp;nbsp; It looks like this can be easily accomplished using the existing ProcessUtility_hook.&amp;nbsp; They were also concerned about DDL, but again it seems like the existing ProcessUtility_hook would be sufficient to impose coarse-grained restrictions.&amp;nbsp; Ultimately, that may not be the best way to go forward, as it may not provide easy access to all the bits they care about - in particular, I think we will need one or more special-purpose hooks in ALTER TABLE - but it may be enough to do something crude.&lt;br /&gt;&lt;br /&gt;Another very large hole that will need to be plugged is control over large objects.&amp;nbsp; These will need security labels and appropriate access checks.&lt;br /&gt;&lt;br /&gt;Finally, the SE-Linux folks indicated that in the long run they would really like to have row-level access control, but they believe that they can accomplish useful things with an implementation which does not include that capability, as long as they have the "trusted procedure" facility discussed above.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I'm not sure how far we're going to get with this work during the &lt;a href="http://wiki.postgresql.org/wiki/PostgreSQL_9.1_Development_Plan"&gt;PostgreSQL 9.1 time frame&lt;/a&gt;.&amp;nbsp; KaiGai Kohei has poured a tremendous amount of time into this work over the last several years, but progress has been slow.&amp;nbsp; I think one of the big reasons for that is that doing this work in a way that is acceptable to the PostgreSQL community can sometimes require significant refactoring of the existing code.&amp;nbsp; It's not always obvious how to accomplish that, and many of the people who are in the best position to carry it off successfully can't put a lot of time into it unless there is funding attached.&amp;nbsp; So far, no one stepped forward in this area; if that changes, I expect to see much more rapid progress.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-8918941344563151176?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/8918941344563151176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=8918941344563151176' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/8918941344563151176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/8918941344563151176'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/09/se-linux-for-postgresql-part-2.html' title='SE-Linux For PostgreSQL: Part 2'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4314780563700007707</id><published>2010-09-12T07:00:00.000-04:00</published><updated>2010-09-12T07:00:02.636-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>So, Why Isn't PostgreSQL Using Git Yet?</title><content type='html'>Just over a month ago, I wrote a blog posting entitled &lt;a href="http://rhaas.blogspot.com/2010/08/git-is-coming-to-postgresql.html"&gt;Git is Coming to PostgreSQL&lt;/a&gt;, in which I stated that we planned to move to git sometime in the next several weeks.&amp;nbsp; But a funny thing happened on the way to the conversion.&amp;nbsp; After we had frozen the &lt;a href="http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/"&gt;CVS repository&lt;/a&gt; and while Magnus Hagander was in the process of performing the migration, using &lt;a href="http://cvs2svn.tigris.org/cvs2git.html"&gt;cvs2git&lt;/a&gt;, I happened to notice - just by coincidence - that the conversion &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-08/msg01247.php"&gt;had big problems&lt;/a&gt;.&amp;nbsp; cvs2git had interpreted some of the cases where we'd back-patched commits from newer branches into older branches as merges, and generated merge commits.&amp;nbsp; This made the history look really weird: the merge commits pulled in the entire history of the branch behind them, with the result that newer commits appeared in the commit logs of older branches, even we didn't commit them there and the changes were not present there.&lt;br /&gt;&lt;br /&gt;Fortunately, Max Bowsher and Michael Haggerty of the cvs2git project were able to jump in and help us out, first by advising us &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-08/msg01274.php"&gt;not to panic&lt;/a&gt;, and secondly by &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-08/msg01459.php"&gt;making it possible to run cvs2git in a way that doesn't generate merge commits&lt;/a&gt;.&amp;nbsp; Once this was done, Magnus reran the conversion.&amp;nbsp; The results looked a lot better, but there were still a few things we weren't quite happy with.&amp;nbsp; There were a number of "manufactured commits" in the history, for a variety of reasons.&amp;nbsp; Some of these were the result of spurious revisions in the CVS history of generated files that were removed from CVS many years ago; Max Bowsher &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-09/msg00236.php"&gt;figured out how to fix this&lt;/a&gt; for us.&amp;nbsp; Others represented cases where a file was deleted from the trunk and then later re-added to a back branch.&amp;nbsp; But because we are running a very old version of CVS (shame on us!), &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-09/msg00456.php"&gt;not enough information was recorded&lt;/a&gt; in the RCS files that make up the CVS repository to reconstruct the commit history correctly.&amp;nbsp; Tom Lane, again with help from the cvs2git folks, &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-09/msg00587.php"&gt;has figured out how to fix this&lt;/a&gt;.&amp;nbsp; We also end up with a few &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-08/msg01815.php"&gt;spurious branches&lt;/a&gt; (which are easily deleted), and there are some other manufactured commits that Tom &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-09/msg00602.php"&gt;is still investigating&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In spite of the difficulties, I'm feeling optimistic again.&amp;nbsp; We seem to have gotten past the worst of the issues, and seem to be making progress on the ones that remain.&amp;nbsp; It seems likely that we may decide to postpone the migration until after the upcoming CommitFest is over (get your patches in by September 14!) so it may be a bit longer before we get this done - but we're making headway.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4314780563700007707?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4314780563700007707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4314780563700007707' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4314780563700007707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4314780563700007707'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/09/so-why-isnt-postgresql-using-git-yet.html' title='So, Why Isn&apos;t PostgreSQL Using Git Yet?'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-2114901890525753920</id><published>2010-09-10T16:21:00.000-04:00</published><updated>2010-09-10T19:05:18.265-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='selinux'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>SE-Linux For PostgreSQL: Part 1</title><content type='html'>I made the trip down to &lt;a href="http://omniti.com/is/here"&gt;OmniTI&lt;/a&gt; headquarters just south of Baltimore, MD this Wednesday for &lt;a href="http://pugs.postgresql.org/bwpug"&gt;BWPUG&lt;/a&gt;.  &lt;a href="http://www.xzilla.net/blog/2010/Sep/BWPUG-September-Meeting-2010-09-08-PostgreSQL-Security-and-SE-Postgres.html"&gt;This month's topic&lt;/a&gt; was the ongoing project to integrate SE-Linux with PostgreSQL.  Besides myself, Stephen Frost, Greg Smith, Robert Treat were all there from the PostgreSQL community, along with David Quigley and Joshua Brindle from the SE-Linux community.  It was a very productive meeting and I learned a lot about what the SE-Linux community is looking for from &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;We first discussed the current status of the project.  Following discussions with Stephen Frost, KaiGai Kohei, and Greg Smith at &lt;a href="http://www.pgcon.org/2010/"&gt;PGCon 2010&lt;/a&gt;, I wrote and committed four patches which have, I think, helped to clear the way for an eventual loadable module implementing basic SE-Linux support for PostgreSQL; and I also committed a fifth patch by KaiGai Kohei.  These were, in order of commit:&lt;br /&gt;&lt;br /&gt;1. &lt;a href="http://archives.postgresql.org/pgsql-committers/2010-07/msg00118.php"&gt;Add a hook in ExecCheckRTPerms()&lt;/a&gt;.  This is just a very simple hook to allow a loadable module to gain control at the time DML relation permissions are checked.  Whenever a SELECT, INSERT, UPDATE, or DELETE statement is invoked, this function gets a listed of the relation OIDs and can choose to allow the statement to proceed or throw an error.  (It could also potentially do other things, like write to a log file, if that were useful for some reason.)&lt;br /&gt;&lt;br /&gt;2. &lt;a href="http://archives.postgresql.org/pgsql-committers/2010-07/msg00221.php"&gt;Centralize DML permissions-checking logic&lt;/a&gt;.  KaiGai Kohei spotted the fact that the previous patch didn't actually work for a couple of important cases.  In particular, COPY did not previously go through ExecCheckRTPerms(), and there is some hairy code inside the foreign key stuff that also needed adjustment to work properly with this hook.  This patch, by KaiGai Kohei, cleaned all of that up.  So as far as I know, we now have a single point for all DML permissions checking, and a hook function at that point.  Yeah!&lt;br /&gt;&lt;br /&gt;Unfortunately, in order to do label-based security, a simple hook function is not enough.  You also need a place to store the labels, and ideally that place should be a PostgreSQL system catalog.  I had initially thought that we would add a security label column to the system catalog for each object type, but that would require fairly invasive changes across the whole system and carry some minor performance penalty even for people who did not use it.  At PGCon, we came up with the idea of storing all security labels for all objects in a separate catalog.  Security labels are, in essence, just strings, which we don't try to interpret but which have some meaning (the details of which we need not understand) to an external security provider such as SE-Linux.&lt;br /&gt;&lt;br /&gt;As luck would have it, we already have a model for such a facility: the COMMENT statement already knows how to store arbitrary strings which it does not attempt to interpret for arbitrary database objects, using a catalog (actually two catalogs) dedicated to that purpose.   Unfortunately, the comment code is quite large, and, as it turned out, buggy, so it didn't seem like a good idea to copy-and-paste it into a new file and then hack it up from there, as I had initially hoped to do.  So that led to three more patches.&lt;br /&gt;&lt;br /&gt;3. &lt;a href="http://archives.postgresql.org/pgsql-committers/2010-08/msg00057.php"&gt;Standardize get_whatever_oid functions for object types with unqualified names&lt;/a&gt;.  As it turns out, one of the things that the comment code needed to do over and over again was examine the parse tree representation of an object and convert it to an OID by looking up the name in a system catalog.  But there wasn't any standard way to do this, and in some cases the code was quite lengthy and already duplicated in multiple places throughout our source base.  This patch cleaned that up, by introducing a standard API and adjusting the existing OID-getter functions, or adding new ones, for tablespaces, databases, roles, schemas, languages, and access methods, to conform to that API.&lt;br /&gt;&lt;br /&gt;4.  &lt;a href="http://archives.postgresql.org/pgsql-committers/2010-08/msg00058.php"&gt;Standardize get_whatever_oid functions for other object types&lt;/a&gt;.  More of the same, this time for text search parsers, dictionaries, templates, and configs; as well as for conversions, constraints, operator classes, operator families, rules, triggers, and casts.&lt;br /&gt;&lt;br /&gt;5. &lt;a href="http://archives.postgresql.org/pgsql-committers/2010-08/msg00353.php"&gt;Rewrite comment code for better modularity, and add necessary locking&lt;/a&gt;.  This patch took the refactoring in the previous two patches one step further.  The functions in the previous patches provide a way to translate a named object of a different type to an OID.  This patch creates a more general API that can be passed an object type and a parse tree and return an ObjectAddress, which is an internal representation that can point to a database object of any type.  The ObjectAddress representation is used for management of dependencies between database objects (e.g. you can't drop a table if there's a view using it, unless you also drop the view) as well as by the comment code, and they will be useful for security label support as well.&lt;br /&gt;&lt;br /&gt;This new facility also fixes a longstanding locking bug in the COMMENT code, which still exists (and likely won't be fixed) in 9.0 and all prior releases.  An object that is dropped concurrently with a COMMENT operation on that same object could lead to an orphaned comment in the pg_description or pg_shdescription catalog.  If another object of the same type is subsequently assigned the same OID, it will inherit the orphaned comment.  This is fairly unlikely and, for comments, fairly innocuous, but it would obviously create a potential security hole for security labels.&lt;br /&gt;&lt;br /&gt;With these preliminary patches in place, I think we're now well-positioned to introduce the major piece of functionality which we will need to support SE-Linux integration: an in-core security label facility for use by SE-Linux and perhaps other label-based security systems.  Stephen Frost, KaiGai Kohei, and I have had extensive discussions about the design of this facility and there are currently two pending patches by KaiGai Kohei which are intended to implement that design: one adds the &lt;a href="https://commitfest.postgresql.org/action/patch_view?id=371"&gt;basic security facility and commands for manually applying labels&lt;/a&gt;, and the other adds &lt;a href="https://commitfest.postgresql.org/action/patch_view?id=375"&gt;hooks at table creation time to allow enhanced security providers to automatically set a label on newly created tables&lt;/a&gt;.  I have not yet reviewed these patches in detail, but I hope to see them committed - likely with some modifications - within the next month.&lt;br /&gt;&lt;br /&gt;In the second part of this blog post, I'll go over what I learned from David and Joshua (who were extremely helpful in explaining SE-Linux to me), the additional facilities which they felt would be necessary for a minimally useful SE-Linux integration,  and what they'd like to see over the longer term.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-2114901890525753920?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/2114901890525753920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=2114901890525753920' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2114901890525753920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/2114901890525753920'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/09/se-linux-for-postgresql-part-1.html' title='SE-Linux For PostgreSQL: Part 1'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-6455856207862406602</id><published>2010-08-24T08:16:00.000-04:00</published><updated>2010-08-24T08:29:52.222-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Version Numbering</title><content type='html'>Over the last few days, there's been a debate raging on &lt;a href="http://archives.postgresql.org/pgsql-hackers/"&gt;pgsql-hackers&lt;/a&gt; on the subject of version numbering.  There are many thoughtful (and some less-thoughtful) opinions on the &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-08/msg01477.php"&gt;thread&lt;/a&gt; that you may wish to read, but I thought the most interesting was a link &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-08/msg01540.php"&gt;posted&lt;/a&gt; by Thom Brown to a blog post called &lt;a href="http://rwec.co.uk/blog/2010/02/golden-rules-of-version-naming/"&gt;The Golden Rules of Version Naming&lt;/a&gt;.  If you haven't seen it, it's definitely worth a read.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-6455856207862406602?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/6455856207862406602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=6455856207862406602' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6455856207862406602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6455856207862406602'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/08/version-numbering.html' title='Version Numbering'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-6222102814906824491</id><published>2010-08-16T12:50:00.000-04:00</published><updated>2010-08-16T13:54:17.965-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Why We're Conservative With PostgreSQL Minor Releases</title><content type='html'>Last week, a PostgreSQL user filed bug #5611, complaining about a performance regression in PostgreSQL 8.4 as compared with PostgreSQL 8.2.  The regression occurred because PostgreSQL 8.4 is capable of inlining SQL functions, while PostgreSQL 8.2 is not.  The bug report was also surprising to me, because in my experience, inlining SQL queries has always improved performance, often dramatically.  But this user managed unluckily hit a case where the opposite is true: inlining caused a function which had previously been evaluated just once to be evaluated multiple times.  Fortunately, there is an easy workaround: writing the function using the "plpgsql" language rather than the "sql" language defeats inlining.&lt;br /&gt;&lt;br /&gt;Although the bug itself is interesting (let's face it, I'm a geek), what I found even more interesting was that I totally failed to appreciate the possibility that inlining an SQL function could ever fail to be a performance win.  Prior to last week, if someone had asked me whether that was possible, I would have said that I didn't think so, but you never know...&lt;br /&gt;&lt;br /&gt;And that is why the PostgreSQL project maintains stable branches for each of our major releases for about five years.  Stable branches don't get new features; they don't get performance enhancements; they don't even get tweaks for things we wish we'd done differently or corrections to behavior of doubtful utility.  What they do get is fixes for bugs (like: without this fix, your data might get corrupted; or, without this fix, the database might crash), security issues, and a smattering of documentation and translation updates.  When we release a new major release (or actually about six months prior to when we actually release), development on that major release is &lt;span style="font-style: italic;"&gt;over&lt;/span&gt;.  Any further changes go into the next release.&lt;br /&gt;&lt;br /&gt;On the other hand, we don't abandon our releases once they're out the door, either.  We are just now in the process of ceasing to support PostgreSQL 7.4, which was released in November 2003.  For nearly seven years, any serious bugs or security vulnerabilities which we have discovered either in that version or any newer version have been addressed by releasing a new version of PostgreSQL 7.4; the current release is 7.4.29.  Absent a change in project policy, 7.4.30 will be the last 7.4.x release.&lt;br /&gt;&lt;br /&gt;If you're running PostgreSQL 8.3 or older, and particularly if you're running PostgreSQL 8.2 or older, you should consider an upgrade, especially once PostgreSQL 9.0 comes out.  Each release of PostgreSQL includes many exciting new features: new SQL constructions, sometimes new data types or built-in functions, and performance and manageability enhancements.  Of course, before you upgrade to PostgreSQL 8.4 (or 9.0), you should carefully test your application to make sure that everything still works as you expect.  For the most part, things tend to go pretty smoothly, but as bug #5611 demonstrates, not always.&lt;br /&gt;&lt;br /&gt;Of course, this upgrade path is not for everyone.  Application retesting can be difficult and time-consuming, especially for large installations.  There is nothing wrong with staying on the major release of PostgreSQL that you are currently using.  But it is very wise to upgrade regularly to the latest minor version available for that release.  The upgrade process is generally as simple as installing the new binaries and restarting the server (but see the release notes for your version for details), and the PostgreSQL community is firmly committed to making sure that each of these releases represents an &lt;span style="font-style: italic;"&gt;improvement&lt;/span&gt; to performance and stability rather than a step backwards.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-6222102814906824491?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/6222102814906824491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=6222102814906824491' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6222102814906824491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6222102814906824491'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/08/why-were-conservative-with-postgresql.html' title='Why We&apos;re Conservative With PostgreSQL Minor Releases'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-802315946437802951</id><published>2010-08-13T09:40:00.000-04:00</published><updated>2010-08-13T10:15:27.716-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>How I Hack on PostgreSQL</title><content type='html'>Today's &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-08/msg00953.php"&gt;post&lt;/a&gt; by &lt;a href="http://blog.tapoueh.org/"&gt;Dimitri Fontaine&lt;/a&gt; gave me the idea of writing a blog posting about the tools I use for &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; development.  I'm not saying that what I do is the best way of doing it (and it's certainly not the only way of doing it), but it's one way of doing it, and I've had good luck with it.&lt;br /&gt;&lt;br /&gt;What commands do I use?  The following list shows the ten commands that occur most frequently in my shell history.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;[rhaas pgsql]$ history  | awk '{print $2}' | sort | uniq -c | sort -rn | head&lt;br /&gt; 250 git&lt;br /&gt;  57 vi&lt;br /&gt;  31 %%&lt;br /&gt;  25 cd&lt;br /&gt;  24 less&lt;br /&gt;  20 up&lt;br /&gt;  18 make&lt;br /&gt;  13 pg_ctl&lt;br /&gt;  10 ls&lt;br /&gt;   8 psql&lt;/pre&gt;&lt;br /&gt;Wow, that's a lot of git.  I didn't realize that approximately half of all the commands I type are git commands.  Let's see some more details.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;[rhaas pgsql]$ history  | awk '$2 == "git" { print $3}' | sort | uniq -c | sort -rn | head&lt;br /&gt;  93 diff&lt;br /&gt;  91 grep&lt;br /&gt;  15 log&lt;br /&gt;  10 commit&lt;br /&gt;   8 checkout&lt;br /&gt;   7 add&lt;br /&gt;   6 reset&lt;br /&gt;   5 clean&lt;br /&gt;   4 pull&lt;br /&gt;   3 branch&lt;/pre&gt;&lt;br /&gt;As you can see, I use &lt;span style="font-family: courier new;"&gt;git diff &lt;/span&gt;and &lt;span style="font-family: courier new;"&gt;git grep&lt;/span&gt; far more often than any other commands.  The most common things I do with git diff are just plain &lt;span style="font-family: courier new;"&gt;git diff&lt;/span&gt;, which displays the unstaged changes in my working tree (so I can see what I've changed, or what a patch I've just applied has changed) and &lt;span style="font-family: courier new;"&gt;git diff master&lt;/span&gt; (which  shows all the differences between my working tree and the master branch; this is because I frequently use git branches to hack on a patch I'm working on).   A great deal of the work of writing a good patch - or reviewing one - consists in looking at the code over and over again and thinking about whether every change can be justified and proven correct.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;git grep&lt;/span&gt; does a recursive grep starting at the current directory, but only examines files checked into git (not build products, for example).  I use this as a way to find where a certain function is defined (by grepping for the name of the function at the start of a line) and as a way to find all occurrences of an identifier in the code (which is an absolutely essential step in verifying the correctness of your own patch, or someone else's).&lt;br /&gt;&lt;br /&gt;As you can also see, my preferred editor is vi (really vim).  This might not be the best choice for everyone, but I've been using it for close to 20 years, so it's probably too late to learn something else now.  I think Dimitri Fontaine said it well in the post linked above: the best editor you can find is the one you master.  Having said that, if you do even a small amount of programming, you're likely to spend a lot of time in whatever editor you pick, so it's probably worth the time it takes to learn a reasonably powerful one.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-802315946437802951?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/802315946437802951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=802315946437802951' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/802315946437802951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/802315946437802951'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/08/how-i-hack-on-postgresql.html' title='How I Hack on PostgreSQL'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-5852027121178015108</id><published>2010-08-07T22:08:00.000-04:00</published><updated>2010-08-07T23:12:30.221-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Git is Coming to PostgreSQL</title><content type='html'>As discussed at the &lt;a href="http://wiki.postgresql.org/wiki/PgCon_2010_Developer_Meeting"&gt;PGCon 2010 Developer Meeting&lt;/a&gt;, &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; is scheduled to adopt &lt;a href="http://git-scm.com/"&gt;git&lt;/a&gt; as its version control system some time in the next few weeks.  &lt;a href="http://people.planetpostgresql.org/andrew/"&gt;Andrew&lt;/a&gt;&lt;a href="http://people.planetpostgresql.org/andrew/"&gt; Dunstan&lt;/a&gt;, who maintains the &lt;a href="http://pgbuildfarm.org/"&gt;PostgreSQL build farm&lt;/a&gt;, has adapted the build farm code to work with either CVS or git; meanwhile, &lt;a href="http://www.hagander.net/"&gt;Magnus Hagander &lt;/a&gt;has done a &lt;a href="http://git.postgresql.org/gitweb?p=postgresql-migration.git;a=summary"&gt;trial conversion&lt;/a&gt; so that we can all see what the new repository will look like.  My small contribution was to write &lt;a href="http://wiki.postgresql.org/wiki/Committing_with_Git"&gt;some documentation for the PostgreSQL committers&lt;/a&gt;, which has subsequently been further edited by &lt;a href="http://users.tkk.fi/%7Ehlinnaka/"&gt;Heikki Linnakangas&lt;/a&gt; (the link here is to his personal web page, whose one complete sentence is one of the funnier things I've read on the Internet).&lt;br /&gt;&lt;br /&gt;I don't think the move to git is going to be radical change; indeed, we're taking some pains to make sure that it isn't.  But it will make my life easier in several small ways.  First, the existing git clone of the PostgreSQL CVS repository is flaky and unreliable.  The back-branches have had severe problems in this area for some time (some don't build), and the master branch (aka CVS HEAD) has periodic issues as well.  At present, for example, the regression tests for contrib/dblink fail on a build from git, but pass on a build from CVS.  While we might be able to fix (or minimize) these issues by fixing bugs in the conversion code, switching to git should eliminate them.  Also, since I do my day-to-day PostgreSQL work using git, it will be nice to be able to commit that way also - it should be both faster (CVS is very slow by comparison) and less error-prone (no cutting and pasting the commit message, no forgetting to add a file in CVS that you already added in git).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-5852027121178015108?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/5852027121178015108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=5852027121178015108' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5852027121178015108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5852027121178015108'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/08/git-is-coming-to-postgresql.html' title='Git is Coming to PostgreSQL'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-5215224271922724727</id><published>2010-07-29T11:02:00.000-04:00</published><updated>2010-07-29T11:07:16.304-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Multi-Tenancy and Virtualization</title><content type='html'>In a recent &lt;a href="http://gigaom.com/2010/07/17/vmware-knows-the-cloud-doesn%E2%80%99t-need-server-virtualization/"&gt;blog post on Gigaom&lt;/a&gt;, Simeon Simeonov argues that virtualization is on the way out, and discusses &lt;a href="http://www.vmware.com/"&gt;VMware&lt;/a&gt;'s move toward &lt;a href="http://en.wikipedia.org/wiki/Platform_as_a_service"&gt;platform-as-a-service&lt;/a&gt;  computing.  In a nutshell, his argument is that virtualization is  inefficient, and is essentially a last resort when legacy applications  can't play nicely together in the same sandbox.  In other words, the  real goal for IT shops and service providers is not virtualization per se, but multi-tenancy, cost-effective use of hardware, and high  availability.  Find any two servers in the average corporate data center  and ask why they're not running on the same machine.  It's a good bet  you'll get one of the following four answers: (1) machine A is running a  piece of software that misbehaves if run on the same machine as some  piece of software running on machine B, (2) a single server couldn't  handle the load, (3) one of those servers provides redundancy for the  other, or (4) no particular reason, but we haven't gotten around to  consolidating them yet.  In my experience, the first answer is probably  the most common.  But as Simeonov points out, the ideal solution is not  virtualization, but better software - specifically, platforms that can transparently service multiple customers.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; is very strong in this area.  Hosting providers such as &lt;a href="http://hub.org/"&gt;hub.org&lt;/a&gt; provision databases for multiple customers onto a single PostgreSQL instance; and here at &lt;a href="http://www.enterprisedb.com/"&gt;EnterpriseDB&lt;/a&gt;,  we support several customers who do much the same thing.  Databases in  PostgreSQL provide a high degree of isolation: many configuration  parameters can be set on a per-database basis, extensions can be  installed into a single database without affecting other databases that  are part of the same instance, and each database can in turn contain  multiple schemas.  The ability to have multiple databases, each  containing multiple schemas, makes the PostgreSQL model more flexible  than Oracle or MySQL, which have only a single tier system.  In the  upcoming PostgreSQL 9.0 release, the new &lt;a href="http://developer.postgresql.org/pgdocs/postgres/sql-grant.html"&gt;grant on all in schema&lt;/a&gt; and &lt;a href="http://developer.postgresql.org/pgdocs/postgres/sql-alterdefaultprivileges.html"&gt;default privileges&lt;/a&gt;  features will further simplify user administration in multi-user and multi-tenant environments.  Behind the scenes,  a PostgreSQL instance uses a single buffer pool which can be  efficiently shared among any number of databases without excessive lock  contention.  This is critical.  Fragmenting memory into many small  buffer pools prevents databases from scaling up (using more memory) when  under heavy load, and at the same time prevents databases from scaling  down (using less memory) when not in use.  By managing all databases out  of a single pool, PostgreSQL can allow a single database to use every  block in the buffer pool - if no other databases are in use - or no  blocks at all - if the database is completely idle.&lt;br /&gt;&lt;br /&gt;Simeonov seems to feel that virtualization has already nearly run  its course, and predicts that the market will hit its peak within three  years.  That doesn't seem likely to me.  I think there is an awful  lot of crufty hardware and software out there that could benefit from  virtualization, but it's working right now, so no one is eager to make  changes that might break something.  As the physical equipment starts to  fail, IT administrators will think about virtualization, but hardware  that isn't touched can sometimes run for a surprisingly long time, so I  don't expect server consolidation projects to disappear any time soon.   More importantly, Simeonov seems to assume that all new applications  will be developed using platform-as-a-service architectures such as &lt;a href="http://code.google.com/appengine/"&gt;Google App Engine&lt;/a&gt;, &lt;a href="http://www.bungeeconnect.com/"&gt;Bungee&lt;/a&gt;, &lt;a href="http://www.engineyard.com/"&gt;Engine Yard&lt;/a&gt;, and &lt;a href="http://heroku.com/"&gt;Heroku&lt;/a&gt;.  While some certainly will be, it seems unlikely that the traditional  model of application development, using a dedicated web server and a  dedicated database running on a physical or virtual machine will  disappear overnight.  For one thing, choosing one of those vendors means  being locked into that vendor's API - and choice of programming  language.  Bungee and Heroku are Ruby environments, for example, while  Google App Engine offers Java and Python.  Good luck making the switch!&lt;br /&gt;&lt;br /&gt;So, if plain old virtual machines are going to be around for a  while, how does PostgreSQL stack up in that environment?  Not too bad.   Of course, write-intensive workloads will suffer from the generalized  slowness of virtualized I/O.  But PostgreSQL is designed to run well  even in a very small memory  footprint, to take good advantage of the OS buffer cache and process  scheduler, and to be portable across a &lt;a href="http://www.postgresql.org/docs/current/interactive/supported-platforms.html"&gt;wide variety of platforms&lt;/a&gt;.   If your database is small enough to fit in memory, performance should  be good.  And if your database isn't small enough to fit in  memory, there's not much point in virtualizing it: you're going to need a  dedicated machine either way.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-5215224271922724727?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/5215224271922724727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=5215224271922724727' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5215224271922724727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5215224271922724727'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/07/multi-tenancy-and-virtualization.html' title='Multi-Tenancy and Virtualization'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-7171030260597527513</id><published>2010-07-25T20:58:00.000-04:00</published><updated>2010-07-25T21:19:13.481-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='google'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Google and our Documentation</title><content type='html'>As I mentioned in a previous blog post, trying to find pages in the PostgreSQL documentation using Google doesn't work very well: most often, one gets links to older versions.&lt;br /&gt;&lt;br /&gt;A recent thread on &lt;a href="http://archives.postgresql.org/pgsql-performance/"&gt;pgsql-performance&lt;/a&gt; (somewhat off-topic for that mailing list, but that's where it was) &lt;a href="http://archives.postgresql.org/pgsql-performance/2010-07/msg00334.php"&gt;suggested&lt;/a&gt; that perhaps we could use Google's &lt;a href="http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html"&gt;canonical URL&lt;/a&gt; feature to work around this problem.&lt;br /&gt;&lt;br /&gt;Another &lt;a href="http://archives.postgresql.org/pgsql-performance/2010-07/msg00353.php"&gt;suggestion&lt;/a&gt; was that we ask people who link to our docs to link to &lt;a href="http://postgresql.org/docs/current/"&gt;http://postgresql.org/docs/current/&lt;/a&gt; (or some sub-page) rather than linking to a specific version (e.g. the same URL with 8.4 in place of current).  That way, as new versions come out, everyone's links will still be pointing at the latest version of the docs, helping the new versions accumulate "Google karma" more quickly than they would otherwise.  Or at least, that's the idea: I have no idea whether it would actually work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-7171030260597527513?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/7171030260597527513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=7171030260597527513' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/7171030260597527513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/7171030260597527513'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/07/google-and-our-documentation.html' title='Google and our Documentation'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-6674990038465837840</id><published>2010-07-22T15:18:00.000-04:00</published><updated>2010-07-22T16:03:27.349-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Best Patches of 9.1CF1</title><content type='html'>Although PostgreSQL 9.0 isn't out yet, we began the &lt;a href="https://commitfest.postgresql.org/action/commitfest_view?id=6"&gt;first CommitFest for PostgreSQL 9.1 development&lt;/a&gt; on July 15, 2010.  Our goal is to review every patch submitted by then before August 15.  While we're only a week into the CommitFest, I already have some favorite patches: none of which are committed yet, so they might die, get withdrawn, changed, etc.  But here they my top picks.&lt;br /&gt;&lt;br /&gt;1. Simon Riggs wrote a very nice patch to &lt;a href="https://commitfest.postgresql.org/action/patch_view?id=347"&gt;reduce the lock level required for various DDL statements&lt;/a&gt;.  We haven't yet come up with clearly workable ideas for allowing multiple DDL statements to execute on the same table at the same time, but what this patch will do is allow certain DDL commands to run in parallel with DML.  Some versions of ALTER TABLE will lock out everything (as they all do, presently), some will lock out INSERT/UPDATE/DELETE/VACUUM statements but allow SELECT to run in parallel, and some will only lock out concurrent DDL and VACUUM operations (like ALTER TABLE ... SET WITHOUT CLUSTER).  This should be really nice for anyone administering a busy database.&lt;br /&gt;&lt;br /&gt;2. My employer, &lt;a href="http://www.enterprisedb.com/"&gt;EnterpriseDB&lt;/a&gt;, asked me to write a patch that &lt;a href="https://commitfest.postgresql.org/action/patch_view?id=335"&gt;reduces the size of most numeric values on disk&lt;/a&gt;. This was based on a design proposal from Tom Lane a few years ago, and turned out to be pretty simple to code up. Currently, our numeric data type always has a 4-byte header specifying the weight of the first digit and display scale.  For the values people typically do store, that's overkill.  This patch allows a 2-byte header to be used opportunistically, when we can cram everything in; but the old format can still be understood, so it doesn't break pg_upgrade.  It'll be interesting to see whether people can see a noticeable change in the size of their disk footprint when this patch is used.  And maybe we could even get by with a 1-byte header sometimes... but that's a thought for another patch.&lt;br /&gt;&lt;br /&gt;3. Kevin Grittner posted a patch to &lt;a href="https://commitfest.postgresql.org/action/patch_view?id=310"&gt;implement true serializability&lt;/a&gt;.  I haven't studied the code in detail, and I'm not sure how soon we can hope to see this committed, but it's pretty cool.  Our current serialization techniques are pretty good, but this should be a whole lot better whose application logic relies heavily on the absence of &lt;a href="http://rhaas.blogspot.com/2010/07/distributed-serialization-anomalies.html"&gt;serialization anomalies&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-6674990038465837840?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/6674990038465837840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=6674990038465837840' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6674990038465837840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6674990038465837840'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/07/best-patches-of-91cf1.html' title='Best Patches of 9.1CF1'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-8652289239592680137</id><published>2010-07-07T10:51:00.000-04:00</published><updated>2010-07-07T16:34:43.130-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Distributed Serialization Anomalies</title><content type='html'>One of the more difficult responsibilities of a database is to provide you with the illusion that transactions on the system are executed sequentially, one after another, while in fact allowing as much parallelism as possible.  PostgreSQL's MVCC implementation does this using "snapshots": each statement (or, if you choose the &lt;a href="http://www.postgresql.org/docs/8.4/static/transaction-iso.html#XACT-SERIALIZABLE"&gt;serializable isolation level&lt;/a&gt;, each transaction), upon first access to the database, records which transactions have committed as of that moment, and everything it does afterwards will see the effect of those transactions, but not any transactions committed later.  (There are &lt;a href="http://www.postgresql.org/docs/current/static/transaction-iso.html#XACT-READ-COMMITTED"&gt;some exceptions&lt;/a&gt; to this rule when using READ COMMITTED mode with INSERT, UPDATE, or DELETE statements.)&lt;br /&gt;&lt;br /&gt;This produces, more or less, the illusion that SQL statements execute sequentially, with each one completing its work before the next one begins.  This illusion is extremely important and valuable in many real-world applications.  For example, if you transfer money from your checking account to your savings account, a banking application might insert two new rows into the "banking_transactions" table: one to show the debit from checking, and another to show the credit to savings.  It wouldn't be good if some other query saw just one of these two new rows: it would look as if the money disappeared from checking but did not appear in savings, or perhaps as if it had appeared in savings without disappearing from checking.  You'd be unhappy about the first scenario, and the bank would be unhappy about the second one.  This type of scenario is called a &lt;span style="font-weight: bold;"&gt;serialization anomaly&lt;/span&gt;, and databases are responsible for preventing them.  In this case, it's pretty easy to make sure this problem can't happen: just do both inserts within a single transaction, and then commit it.&lt;br /&gt;&lt;br /&gt;Things get a little trickier when there's more than one database involved.  Suppose that I'm moving money from my account (at one branch) to my friend Magnus's account (at a different branch of the same bank).  As before, we must make two transaction entries: one showing the debit to my account, and the other showing the credit to his account.  We can start transactions on both nodes and do the inserts, but it's not possible to commit both transactions at the very same instant: there could always be a crash after one transaction commits, but before the other one commits.&lt;br /&gt;&lt;br /&gt;We can work around this problem to some extent using a protocol called &lt;a href="http://en.wikipedia.org/wiki/Two-phase_commit_protocol"&gt;two-phase commit&lt;/a&gt;: we'll issue a "PREPARE TRANSACTION" command in both transactions, which should be enough to guarantee that a subsequent "COMMIT PREPARED" command, even after an intervening crash, has no chance of failure.  So, we start a transaction on each database, do an insert on each database, prepare both transactions, and then commit both transactions.  If there's a crash (or loss of connectivity) after either transaction is prepared but before both transactions are committed, we can still get things back to a consistent state once things are back up again.  How?  We look to see if either transaction committed; if so, we commit the other one.  If not, we see whether both transactions were succesfully prepared; if so, we can commit or abort both; if not, we must abort both.&lt;br /&gt;&lt;br /&gt;This solves the problem of making sure that no money can be &lt;span style="font-style: italic;"&gt;permanently&lt;/span&gt; lost (or created), but there will still be a period of time during which we can see inconsistent views of the system as a whole.  Imagine that the bank auditor comes along and runs a report across all bank branches adding up the bank's assets and liabilities.  It's possible that he'll query one of the two databases involved in our hypothetical funds transfer before the transaction commits on that node, but by the time he visits the other one, it's committed - therefore he'll see the transferred funds either in both accounts, or in neither one, depending on the order in which he hits the different branches.  This is a &lt;span style="font-weight: bold;"&gt;distributed serialization anomaly&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Distributed serialization anomalies are much harder to avoid than regular serialization anomalies (which are a hard problem all by themselves).  One method - which is used by Postgres-XC - is to have a single authority (which Postgres-XC calls a global transaction manager) which hands out snapshots and transaction IDs across all nodes in the cluster; regrettably, there is a potential for this to become a bottleneck, or a single point of failure (see &lt;a href="http://wiki.postgresql.org/images/4/44/Postgres-XC_Write-Scalable_Cluster.pdf"&gt;Postgres-XC_Write-Scalable_Cluster.pptx&lt;/a&gt;, slides 10 and following).&lt;br /&gt;&lt;br /&gt;Unfortunately, there may not be many good alternatives.  There is a technology called &lt;a href="http://en.wikipedia.org/wiki/Commitment_ordering#Multi-version_CO_.28MVCO.29"&gt;commitment ordering&lt;/a&gt; which seems to have a long paper trail[1] in the academic literature, and which has been studied in relation to MVCC.  The good news is that commitment ordering does not require a global coordinator of any kind; each node operates independently and does not even need to know the identities of the other nodes, or even how many exist.  It requires no additional communication of any kind.  The bad news is that it operates by aborting potentially problematic transactions, and it might end up aborting quite a lot of them.  The rule is simply that the serialization order must match the commit order; so if transaction A reads x and writes y, transaction B reads y; and then transaction A commits, the system will abort B (because there could be a read-write dependency cycle between A and B involving another database).&lt;br /&gt;&lt;br /&gt;Another alternative is to build up a commit-order dependency graph that spans all the databases involved in the transaction.  That is, we imagine a graph with each unaborted transaction as a vertex.  If A reads or updates a row and B subsequently updates it, we add an edge from A to B.  If A updates a row and B subsequently reads the updated version (or a later version), we also add an edge from A to B.  If, at any time, adding an edge to the graph would create a cycle, we abort one of the constituent transactions.  Kevin Grittner and Emmanuel Cecchet &lt;a href="http://archives.postgresql.org/pgsql-hackers/2009-05/msg00217.php"&gt;pointed out&lt;/a&gt; a paper by Michael Cahill on this topic[2]; one of the advantages of this approach is that it is possible to prevent all serialization anomalies, which our current approach &lt;a href="http://www.postgresql.org/docs/8.4/static/transaction-iso.html#MVCC-SERIALIZABILITY"&gt;does not&lt;/a&gt;.  Kevin and Dan Ports have proposed a &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-05/msg01081.php"&gt;patch&lt;/a&gt; for 9.1 which would implement true serializability for a single PostgreSQL database, but it's not clear that this would scale well to a distributed system.&lt;br /&gt;&lt;br /&gt;[1] e.g. The Principle of Commitment Ordering, or Guaranteeing Serializability in a Heterogeneous Environment of Multiple Autonomous Resource-Managers, Yoav Raz, 1990 [&lt;a href="http://yoavraz.googlepages.com/CO63.pdf"&gt;PDF&lt;/a&gt;].&lt;br /&gt;[2] Serializable Isolation for Snapshot Databases, Michael J. Cahill, Uwe Röhm, Alan D. Fekete, 2006 [&lt;a href="http://cahill.net.au/wp-content/uploads/2009/01/real-serializable.pdf"&gt;PDF&lt;/a&gt;].&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-8652289239592680137?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/8652289239592680137/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=8652289239592680137' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/8652289239592680137'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/8652289239592680137'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/07/distributed-serialization-anomalies.html' title='Distributed Serialization Anomalies'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1284693844345861425</id><published>2010-07-05T12:10:00.000-04:00</published><updated>2010-07-05T12:53:31.897-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Concurrent Development</title><content type='html'>PostgreSQL 9.0 beta 3 will be wrapped in the next few days, and at the same time, we'll be branching the tree to begin 9.1 development.  This is a new thing for us.  In the past, we've waited until the previous release was shipped before &lt;a href="http://archives.postgresql.org/pgsql-hackers/2009-07/msg00083.php"&gt;opening the tree to new development&lt;/a&gt;.  However, at the PGCon 2010 development meeting, we &lt;a href="http://wiki.postgresql.org/wiki/PgCon_2010_Developer_Meeting#Timeline_for_9.1"&gt;decided&lt;/a&gt; to try something different this time.&lt;br /&gt;&lt;br /&gt;I believe that the primary motivation for this change was that, as we get closer to release, there are fewer and fewer issues to work on, and fewer and fewer people who can be involved in fixing them.  So, waiting until release to branch the tree leaves a substantial portion of the developer community sitting idle.  A second advantage is that it shortens the time between releases - our tentative plan is to use the &lt;a href="http://wiki.postgresql.org/wiki/PostgreSQL_9.1_Development_Plan"&gt;same release schedule for 9.1&lt;/a&gt; that we did for 9.0.  The first CommitFest for 9.0 began on July 15, 2009, and the first CommitFest for 9.1 will begin on July 15, 2010; the last CommitFest for 9.0 began on January 15, 2010, and the last CommitFest for 9.1 will begin on January 15, 2011.  Of course, the actual release date will almost certainly be different, but the plan is for feature freeze to happen about the same time next year that it did this year, so that we can continue to have releases about a year apart.&lt;br /&gt;&lt;br /&gt;Of course, the danger of &lt;a href="http://books.google.com/books?id=vWBwU5gLo60C&amp;amp;pg=PA36&amp;amp;lpg=PA36&amp;amp;source=bl&amp;amp;ots=bwZi5t5FQZ&amp;amp;sig=kKKTEn34Lor6MmVyRIv5VyQibp0&amp;amp;ei=GAQyTLHWA8Wblgea6qC_Cw&amp;amp;sa=X&amp;amp;oi=book_result&amp;amp;ct=result&amp;amp;resnum=1&amp;amp;ved=0CBIQ6AEwAA#v=onepage&amp;amp;q&amp;amp;f=false"&gt;concurrent development&lt;/a&gt; is that the work people are doing for  9.1 may distract us from finishing 9.0.  Hopefully that won't happen, because I think there is a lot to like about the new process.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1284693844345861425?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1284693844345861425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1284693844345861425' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1284693844345861425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1284693844345861425'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/07/concurrent-development.html' title='Concurrent Development'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-5957546957078536576</id><published>2010-06-24T11:00:00.000-04:00</published><updated>2010-06-30T13:30:26.094-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>PostgreSQL as an In-Memory Only Database</title><content type='html'>There's been some recent, interesting discussion on the &lt;a href="http://archives.postgresql.org/pgsql-performance/"&gt;pgsql-performance&lt;/a&gt; mailing list on using PostgreSQL as an in-memory only database.  In other words, you basically want to use it as a cache, similar to the way that you would use memcached or a NoSQL solution, but with a lot more features.&lt;br /&gt;&lt;br /&gt;If you're interested in doing this, you'll need to configure the system so that you have a convenient, automatic way erase the database cluster and reinitialize it (using initdb) after an operating system crash.  Per discussion on the mailing list, for best performance, it seems best to set up the data directory on a tmpfs and configure the following parameters in postgresql.conf:&lt;br /&gt;&lt;br /&gt;fsync=off&lt;br /&gt;synchronous_commit=off&lt;br /&gt;full_page_writes=off&lt;br /&gt;bgwriter_lru_maxpages=0&lt;br /&gt;&lt;br /&gt;With fsync=off, and most likely also with full_page_writes=off, your database will not be crash-safe - but you don't care, because you're planning to start from scratch after a crash anyway.  If you're familiar with postgresql.conf parameters, setting synchronous_commit=off might seem redundant if you've already set fsync=off, but testing reveals that it still &lt;a href="http://archives.postgresql.org/pgsql-performance/2010-06/msg00277.php"&gt;boosts performance&lt;/a&gt;.  Turning off full_page_writes and bgwriter_lru_maxpages &lt;a href="http://archives.postgresql.org/pgsql-performance/2010-06/msg00315.php"&gt;eliminates I/O&lt;/a&gt; that isn't needed for this use case.&lt;br /&gt;&lt;br /&gt;On a related note, Gavin Roy gave a &lt;a href="http://www.pgcon.org/2010/schedule/events/219.en.html"&gt;talk at PGCon&lt;/a&gt; comparing the performance of PostgreSQL with fsync=off with a number of NoSQL databases.   The results were pretty good, but there might even be room for improvement with some additional tuning.&lt;br /&gt;&lt;br /&gt;If you end up testing a configuration along these lines, please post a comment here or on the pgsql-performance mailing list with your experiences.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-5957546957078536576?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/5957546957078536576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=5957546957078536576' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5957546957078536576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/5957546957078536576'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/06/postgresql-as-in-memory-only-database_24.html' title='PostgreSQL as an In-Memory Only Database'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-545341269404062751</id><published>2010-06-23T16:47:00.000-04:00</published><updated>2010-06-23T17:16:32.303-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Working Toward PostgreSQL 9.0 Beta3</title><content type='html'>We are gradually creeping toward the release of PostgreSQL 9.0, but there's still a ways to go.  We're continuing to get several bug reports per week about problems in 9.0 beta 2 - many thanks to all those who have tested and reported bugs.  Here are some of the issues we've resolved in CVS since beta2:&lt;br /&gt;&lt;br /&gt;- Fix a problem that could cause checkpoints to happen too infrequently when using streaming replication, with certain combinations of settings (Fujii Masao).&lt;br /&gt;- Fix quoting problems in EXPLAIN (FORMAT YAML) output (Dean Rasheed).&lt;br /&gt;- Fix a problem that could cause a "cache lookup failed for type %d" error when using PL/python (Tom Lane).&lt;br /&gt;- Change pg_last_xlog_receive_location() and pg_last_xlog_replay_location() to return NULL instead of 0/0 when they do not apply (Heikki Linnakangas).&lt;br /&gt;- Rename restartpoint_command to archive_cleanup_command, to clarify what it's for (Itagaki Takahiro).&lt;br /&gt;- Allow replication connections to use a "replication" entry in .pgpass (Fujii Masao).&lt;br /&gt;- Fix the newly added vacuumdb -Z option (Josh Berkus).&lt;br /&gt;- Have pg_upgrade create its output files in a less surprising location (Bruce Momjian).&lt;br /&gt;- Fix ALTER LARGE OBJECT and GRANT ... ON LARGE OBJECT to not break when an OID too large to be represented by a signed integer is used (Robert Haas).&lt;br /&gt;- Avoid entering a tight loop when streaming replication hits a corrupt WAL record (Heikki Linnakangas).&lt;br /&gt;- New contrib module for use as an archive_cleanup_command (Simon Riggs).&lt;br /&gt;- Adjust GUC categories to match the docs (Itagaki Takahiro).&lt;br /&gt;- Deprecate the use of =&amp;gt; as an operator name, and remove or rename the new =&amp;gt; operators in 9.0, so we can eventually use this for the purpose the SQL standards committee has in mind (Robert Haas).&lt;br /&gt;- Revert apparently-useless code to add symbol table entries for PL/perl functions (Andrew Dunstan).&lt;br /&gt;- Avoid calling malloc(0) in pg_upgrade (Bruce Momjian).&lt;br /&gt;- Don't allow WAL to be streamed to the standby until it has been fsync'd on the master - otherwise, a master crash can effectively corrupt the standby database (Fujii Masao).&lt;br /&gt;- Fix pg_upgrade problems on Win32 (Bruce Momjian).&lt;br /&gt;- Various documentation improvements.&lt;br /&gt;&lt;br /&gt;If you haven't yet beta-tested PostgreSQL 9.0, there's no time like the present!  Ideally, load up your production data, run your production application against it, and let us know whether anything breaks.  Or, pull the plug a few times and see if anything goes wrong; or try to break Streaming Replication or Hot Standby.  This is shaping up to be a great release - but it's not done yet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-545341269404062751?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/545341269404062751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=545341269404062751' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/545341269404062751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/545341269404062751'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/06/working-toward-postgresql-90-beta3.html' title='Working Toward PostgreSQL 9.0 Beta3'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-7048019542449667110</id><published>2010-06-13T22:20:00.000-04:00</published><updated>2010-06-13T22:46:28.211-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Making PostgreSQL Faster</title><content type='html'>Although we've made great progress in speeding up PostgreSQL over the last few years, there's always more to be done.  Performance, with PostgreSQL as with any other database, is largely determined by the availability of three resources: CPU, memory, and disk.  What could we do to use each of these resources most efficiently?&lt;br /&gt;&lt;br /&gt;PostgreSQL is already pretty efficient at using the CPU.  For high-concurrency databases, I don't anticipate that things will get much better than they already are.  For low-concurrency databases, we need parallel query - that is, the ability to use more than one CPU to process the same query.&lt;br /&gt;&lt;br /&gt;Memory is a little bit more of a problem.  We do a good job keeping our memory footprint small, but we don't manage it terribly well.  work_mem limits the maximum size of a sort or hash, but takes no account of current conditions: if the system is swapping due to memory pressure, you get the same plan as if the system has 40GB of free memory.  And all the memory allocated to shared_buffers remains allocated even when it isn't truly needed.&lt;br /&gt;&lt;br /&gt;I/O is perhaps the biggest problem.  I don't think this problem is unique to PostgreSQL - I believe all databases probably share this pain point to some degree.  Disks are slow.  With respect to PostgreSQL specifically, there are a number of things we need to do to minimize our I/O bandwidth, including index-only scans and further improvements to VACUUM.  Partial vacuum (implemented in 8.4) is a pretty big deal, but there's more that needs to be done.&lt;br /&gt;&lt;br /&gt;We also need to put more effort into minimizing our on-disk format and WAL volume.  The actual disk space is cheap, but the time needed to read and write a larger volume of data hurts performance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-7048019542449667110?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/7048019542449667110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=7048019542449667110' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/7048019542449667110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/7048019542449667110'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/06/making-postgresql-faster.html' title='Making PostgreSQL Faster'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4960117466512356363</id><published>2010-06-08T13:12:00.000-04:00</published><updated>2010-06-08T14:16:23.628-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Why Join Removal Is Cool</title><content type='html'>When people talk to me about the (limited implementation of) join removal that will be part of &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; 9.0, the conversation usually goes in two ways.  Some people ask how the feature works and then say something like "oh, I guess that could be useful every once in a while".  Other people already know exactly how the feature works and usually say some variant of "this is an amazingly wonderful feature that I am looking forward to with great enthusiasm".&lt;br /&gt;&lt;br /&gt;The difference between these two groups of people (I think) is not so much their level of technical knowledge or how closely they've been following &lt;a href="http://archives.postgresql.org/pgsql-hackers/"&gt;pgsql-hackers&lt;/a&gt;, but their use case.  If your database is primarily a data warehouse, my guess is that you won't have many occasions to benefit from join removal.  Where this feature really comes in handy is in OLTP workloads with highly normalized data, in situations where users are generating queries against views (perhaps through some sort of reporting interface) and expecting to get results back immediately.&lt;br /&gt;&lt;br /&gt;Let's take an example.  Suppose you're writing a bug-tracking system.  Each bug has a number of properties associated with it: who reported it, who's working on it, current status, priority, date opened, release for which it's slated to be fixed, date of last status change, date resolved, people who want to get an email when it's updated, comments, etc.  If like me you're a big fan of database normalization, you'll not want to store all of these as text fields.  So you might end up with a table like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;CREATE TABLE bug (&lt;br /&gt;    id                serial,&lt;br /&gt;    reporter_id       integer not null references person (id),&lt;br /&gt;    assigned_to_id    integer references person (id),&lt;br /&gt;    status_id         integer not null references bug_status (id),&lt;br /&gt;    priority_id       integer not null references priority (id),&lt;br /&gt;    target_release_id integer references release (id),&lt;br /&gt;    open_date         date not null,&lt;br /&gt;    ...&lt;br /&gt;    primary key (id)&lt;br /&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You'll probably also end up with some supplementary tables for the items that can exist multiple times, like &lt;span style="font-family: courier new;"&gt;bug_comment&lt;/span&gt; and &lt;span style="font-family: courier new;"&gt;bug_watchers&lt;/span&gt;.  Now, to make reporting easier, you'll probably want to define a view over the bug table that joins to all the other tables, so that it's easy to get the text values for the reporter, status, etc.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;CREATE VIEW bug_view AS&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;SELECT&lt;br /&gt;    b.id,&lt;br /&gt;    b.reporter_id, r.name AS reporter,&lt;br /&gt;    b.assigned_to_id, at.name AS assigned_to,&lt;br /&gt;    b.status_id, s.name AS status,&lt;br /&gt;    b.priority_id, p.name AS priority,&lt;br /&gt;    b.target_release_id, tr.name AS target_release,&lt;br /&gt;    b.open_date,&lt;br /&gt;    ...&lt;br /&gt;FROM&lt;br /&gt;    bug b&lt;br /&gt;    JOIN person r ON b.reporter_id = r.id&lt;br /&gt;    JOIN bug_status s ON b.status_id = s.id&lt;br /&gt;    JOIN priority p ON b.priority_id = p.id&lt;br /&gt;    LEFT JOIN person at ON b.assigned_to_id = at.id&lt;br /&gt;    LEFT JOIN release tr ON b.target_release_id = tr.id;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;And now you can pretty easily write an engine that will let users select the columns they'd like to see from &lt;span style="font-family: courier new;"&gt;bug_view&lt;/span&gt; and the filter conditions they'd like to apply (only open bugs, only bugs slated to be resolved in release X, etc.) via a spiffy web interface.  Note that the reporter, bug status, and priority fields can't be null, so we can use a plain old JOIN, but the bug might be assigned to no one or have no target release, so we use LEFT JOIN in those cases.  (Otherwise, rows where those fields were NULL would not appear in the output.)&lt;br /&gt;&lt;br /&gt;Over time, you'll tend to add more fields.  Scalar fields like open_date don't cause much heartache, but as you add more fields that require joins, your view will tend to slow down.  Some people might say that the answer is simply to denormalize - use natural keys in the bug table, and don't join.  While that solution may be appropriate for some people, it is not without its downsides: &lt;a href="http://en.wikipedia.org/wiki/Database_normalization"&gt;database normalization&lt;/a&gt; was invented for a reason.  The good news is that PostgreSQL is fast and has an excellent query planner, so even fairly complex queries run quite quickly.   The bad news is that every query against the view is going to hit every table that's part of the view definition, so if you add enough of them, it's eventually going to be slow.&lt;br /&gt;&lt;br /&gt;And, realistically, most of the time, users aren't going to want all the columns anyway.  In a web application, 8-12 columns of output in an HTML table is typically about as much as you can squeeze in without starting to have a lot of line wrapping issues.  This leads pretty naturally to the following question: if you don't need all of the columns, can you skip some of those joins and speed up the query?&lt;br /&gt;&lt;br /&gt;Yes.  In PostgreSQL 9.0, we can drop a join against a base table if (1) it's a left join, (2) there is a unique index on all or a subset of the join columns, and (3) none of the attributes from the nullable side of the join are used elsewhere in the query.  So, in the above example, we could skip the joins to &lt;span style="font-family: courier new;"&gt;person at&lt;/span&gt; or &lt;span style="font-family: courier new;"&gt;release tr&lt;/span&gt; if the &lt;span style="font-family: courier new;"&gt;assigned_to&lt;/span&gt; or &lt;span style="font-family: courier new;"&gt;target_release&lt;/span&gt; columns, respectively, are not selected, assuming those tables have unique indexes on their id columns (if they don't, the join might change the number of rows in the output, so we must perform it).&lt;br /&gt;&lt;br /&gt;We can't skip joining to any of the other tables, because those are inner joins.  That's an implementation restriction which I hope will be lifted in PostgreSQL 9.1, but some more logic is needed to make that safe.  In the meantime, a useful workaround may be to write those joins as LEFT JOINs rather the INNER JOINs, in cases where either join type will produce the same results.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4960117466512356363?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4960117466512356363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4960117466512356363' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4960117466512356363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4960117466512356363'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/06/why-join-removal-is-cool.html' title='Why Join Removal Is Cool'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1771695382503192663</id><published>2010-05-24T17:00:00.000-04:00</published><updated>2010-05-24T18:04:12.708-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>An Excellent Developer Meeting</title><content type='html'>I'm really pretty fired up about the results of our &lt;a href="http://wiki.postgresql.org/wiki/PgCon_2010_Developer_Meeting"&gt;PGCon 2010 Developer Meeting&lt;/a&gt;.  Of course, the list of &lt;a href="http://wiki.postgresql.org/wiki/PgCon_2010_Developer_Meeting#Development_Priorities_for_9.1"&gt;what everyone plans to work on&lt;/a&gt; is pretty interesting, and if we got even a fraction of those features we'd have a pretty awesome release.  But that's not really what got me fired up.  What I'm excited about is some of the new and innovative thinking on replication and clustering - or, at any rate, it was new to me.&lt;br /&gt;&lt;br /&gt;Two concepts in particular stand out for me.  First, we discussed the ability to give replication solutions a crash-recoverable view into transaction commit order, a point which Jan Wieck has since &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-05/msg01209.php"&gt;expanded into a full-blown design proposal&lt;/a&gt;.  Jan believes that this infrastructure will be useful not only for his own project, &lt;a href="http://www.slony.info/"&gt;Slony&lt;/a&gt;, but also for other replication solutions such as Londiste which also operate by replaying transactions in commit order.  As I understand it, one of the major advantages of this approach is that it eliminates the need for a global shared counter to track the order of writes (which becomes a bottleneck).  Instead, they can be tagged with their order within the top-level transaction, and then the transactions as a whole can be ordered using the transaction commit ordering information.&lt;br /&gt;&lt;br /&gt;Second, I was very interested in our discussion of a global transaction manager, for which I unfortunately do not have a good link for further reading.  One possible way of avoiding cross-node serialization anomalies in a distributed database environment is to have a single node which knows about all in-flight transactions and hands out snapshots that are coherent across the entire cluster.  &lt;a href="http://wiki.postgresql.org/wiki/Postgres-XC"&gt;Postgres-XC&lt;/a&gt; takes this approach, but there might be value in integrating something like this into core PostgreSQL.  We might imagine allowing one PostgreSQL instance to be configured as a "snapshot provider" and another instance to subscribe to it.  Right now, it's not clear that there's enough benefit to core PostgreSQL from accepting a patch along these lines, but there are several ways that might change as our distributed computing capabilities improve.  For example, if we had a significant SQL/MED implementation, we'd need to think about how to do serialization correctly across multiple nodes; there might also be applications as we work to expand the capabilities of Hot Standby.&lt;br /&gt;&lt;br /&gt;If your eyes are glazing over at this point, you're probably not alone.  These features are fairly esoteric.  Still, I think the fact that we're starting to seriously talk about this topics and consider integrating some of them into core shows that we're starting to understand better what the real needs are for replication and clustering.  As our understanding of those needs continues to improve, I expect to see more capabilities in core PostgreSQL, but perhaps even more importantly, an even stronger set of tools &lt;span style="font-style: italic;"&gt;around&lt;/span&gt; core PostgreSQL that will make it progressively easier to scale horizontally.  I don't expect this to happen overnight, but I feel like we're moving in the right direction.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1771695382503192663?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1771695382503192663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1771695382503192663' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1771695382503192663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1771695382503192663'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/05/excellent-developer-meeting.html' title='An Excellent Developer Meeting'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-4538507979847800357</id><published>2010-05-20T09:10:00.001-04:00</published><updated>2010-05-20T10:37:22.811-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Global Temporary and Unlogged Tables</title><content type='html'>From a technical standpoint, temporary tables in PostgreSQL have three properties that distinguish them from ordinary tables:&lt;br /&gt;&lt;br /&gt;1. They're stored in a special schema, so that they are normally visible only to the creating backend.&lt;br /&gt;2. They are managed by the local buffer manager rather than the shared buffer manager.&lt;br /&gt;3. They are not WAL-logged.&lt;br /&gt;&lt;br /&gt;It makes sense to think about removing these properties one by one, in the order listed above.  Removing just the first property, without doing anything else, doesn't quite make sense, because a table which is managed by the local buffer manager can't be simultaneously accessed by multiple backends.  We could work around this by having each backend access a separate set of files.  This would give us a &lt;span style="font-weight: bold;"&gt;global temporary table&lt;/span&gt; - that is, a table which is visible to everyone, but each backend sees its own contents.  (There is some debate about whether this is the right name, or what the right name for this concept might be - but that's what I'm calling it for now.)&lt;br /&gt;&lt;br /&gt;Removing both of the first two properties also makes sense.  It gives us an &lt;span style="font-weight: bold;"&gt;unlogged table&lt;/span&gt; - that is, a basically ordinary table for which no WAL is written.  (Again, the naming is debatable.)  Such tables are not crash-safe: an unexpected system crash could leave the table hopelessly corrupted.  The only obvious workaround for this problem is to truncate the table on every system restart.&lt;br /&gt;&lt;br /&gt;Why might someone want these new table types?  Global temporary tables are appealing for users who need temporary tables with a relatively fixed structure, and don't want to recreate them in every new session.  In addition to administrative convenience, this avoids the overhead of repeatedly creating and vacuuming the system catalog entries associated with the temporary tables, which may be a performance benefit for some users.&lt;br /&gt;&lt;br /&gt;Unlogged tables are appealing for data that needs to be shared across backends, but which we're willing to lose in the case of a server restart.  For example, consider a web application maintaining a table of active user sessions.  If the server restarts, we may be willing to lose this data.  Everyone will need to log in again, but considering that database crashes are rare, that may not be such a big deal.  Unlogged tables also won't be replicated to standby servers, since replication relies on WAL.  But, on the plus side, skipping WAL-logging should hopefully yield a significant performance benefit.&lt;br /&gt;&lt;br /&gt;I'm going to be working on implementing both of these table types for PostgreSQL 9.1.  In each case, the hardest part seems to be making sure that we clean up properly after a crash or server restart.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-4538507979847800357?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/4538507979847800357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=4538507979847800357' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4538507979847800357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/4538507979847800357'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/05/global-temporary-and-unlogged-tables.html' title='Global Temporary and Unlogged Tables'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1718994890339803728</id><published>2010-05-10T21:20:00.000-04:00</published><updated>2010-05-10T22:43:03.730-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Lots and Lots of PostgreSQL Feature Requests</title><content type='html'>I was surprised and pleased to see that my last blog post, concerning possible directions for &lt;a href="http://rhaas.blogspot.com/2010/05/big-ideas.html"&gt;future PostgreSQL development&lt;/a&gt;, got about five times as many page views as my previous five posts put together, and a total of 70 comments (to date).  This may be partly because it got syndicated on &lt;a href="http://lwn.net/Articles/386351/"&gt;LWN&lt;/a&gt;, where a few more comments were also posted.  I've gone through the comments posted on the blog itself and on the LWN article and counted up the number of times each feature was mentioned.  Of course, this is totally unscientific, but it matches up fairly well to the results of previous surveys and gives me an excuse to talk about a bunch of interesting features.&lt;br /&gt;&lt;br /&gt;1. Materialized Views (12).  See my previous post on &lt;a href="http://rhaas.blogspot.com/2010/04/materialized-views-in-postgresql.html"&gt;Materialized Views in PostgreSQL&lt;/a&gt;.  Long story short, we may quite possibly get a simple version of this in PostgreSQL 9.1, but I suspect a lot more work will be needed to meet some of the use cases people have in mind.&lt;br /&gt;&lt;br /&gt;2. Multi-master replication (6).  This is more or less the holy grail of database geeks; it's a pretty hard problem.   As it turns out, there is a project in the works called &lt;a href="http://wiki.postgresql.org/wiki/Postgres-XC"&gt;Postgres-XC&lt;/a&gt; which does just this.  I hope to learn more about this project next week at &lt;a href="http://www.pgcon.org/2010/"&gt;PGcon&lt;/a&gt;.  My understanding is that it currently supports only a subset of the SQL query types supported by PostgreSQL, but that work is underway to remove these limitations.  Currently, none of the Postgres-XC code can be considered for including in core PostgreSQL because it uses a different license (LGPL), but it's still very interesting as an independent project.&lt;br /&gt;&lt;br /&gt;3. Index-organized tables and/or index-only scans and/or automatic maintenance of CLUSTER order (6).  I've grouped all of these features together because they're really driving toward the same underlying goal: reducing the I/O cost of an index scan.  PostgreSQL will most likely not implement index-organized tables in the sense that Oracle has them, wherein, as I understand it, the table data is stored in the leaf pages of an index.  However, we probably will implement index-only scans, which will allow us to gain some of the same performance benefits.  Automatic maintenance of CLUSTER order would help, too, but I am not aware that anyone is currently working on that project.&lt;br /&gt;&lt;br /&gt;4. MERGE (6).  There is a (very ambitious) Google Summer of Code project to implement this feature.  Stay tuned.  If you're curious about what this feature actually does, I think Simon Riggs has written &lt;a href="http://archives.postgresql.org/pgsql-hackers/2008-04/msg01157.php"&gt;the best description of MERGE I've seen so far&lt;/a&gt;, together with some discussion of the implementation issues.  A few weeks later he discussed he followed up with &lt;a href="http://archives.postgresql.org/pgsql-hackers/2008-04/msg01890.php"&gt;some further notes on the design of the feature&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;5. Partitioning syntax (5).  Itagaki Takahiro proposed a patch to implement this for PostgreSQL 9.0, but we simply ran out of time.  I am hopeful that this will come back to life and be improved and eventually committed for PostgreSQL 9.1.  The patch as proposed would have allowed the use of dedicated syntax to specify partitions and would have automatically created appropriate CHECK constraints for each partition, but would not have automatically routed INSERTs to the proper partition, which I think is necessary to make this really useful.  Of course, others may have different opinions.  :-)&lt;br /&gt;&lt;br /&gt;6. Parallel query execution (5).  This is a very good idea and yet also a very hard problem; I am not aware that anyone has even proposed a possible design for this, yet alone attempted to implement it.  If we implement better SQL/MED support, it might be possible to get some of the benefits of this feature by spreading out data across multiple nodes but making it all appear local by creating remote tables.  Or, it might be possible to leverage some of the I/O bandwidth of remote nodes by adding a feature to support non-local tablespaces (with some kind of specialized daemon process reading and writing remote pages on request).  But neither of these are spot-on: what we really want is the ability to parallelize a query on a single node.&lt;br /&gt;&lt;br /&gt;7. Procedures that can BEGIN, COMMIT, or ABORT transactions (4).  This is another feature that would be great to have, but I am not aware that anyone is currently working on it.&lt;br /&gt;&lt;br /&gt;8. Granular collation support (4).  There are really two halves to this project.  The SQL standard specifies a set of complex rules for determining which collation should be used for a particular comparison or ORDER BY operation.  In PostgreSQL, you could imagine setting the collation for a particular setting using the "SET" command; associating a collation with a particular column; or overriding the collation for a particular instance of ORDER BY or a particular use of the &amp;lt; operator. So, one half of this problem is simply being able to recognize which collation applies in a particular context and doing the sort or comparison under that collation. The other half of the problem is extending our indexing system to handle multiple collations - either the ability to create an index with a particular collation (which can then be used to satisfy queries that pertain to that collation) or even the ability to create a single index which can somehow answer queries pertaining to multiple collations.&lt;br /&gt;&lt;br /&gt;9. Better drivers (4). JDBC was mentioned twice, and asynchronous drivers were mentioned twice. It was also suggested that we should have an "official" Python driver. As a project, we've generally been wary about endorsing other projects, perhaps to our detriment. But good things seem to be happening with the psycopg2 project, especially the recent &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-02/msg01119.php"&gt;license change&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;10. Graph database features (3).  At least one person observed that you can do some of what is wanted here using common table expressions, also known as WITH queries, which are supported beginning in PostgreSQL 8.4.  But several people seem to feel that we should have more graph support; one poster mentioned algorithms such as all-pairs shortest paths.  I don't have a clear idea of what is needed here, but I suspect that some of the things people are looking for here could be implemented as PostgreSQL extensions.  It would be interesting to see some more detailed requirements.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Up_to_eleven"&gt;11&lt;/a&gt;. Documentation (3).  I was surprised to see several requests for documentation among the comments, since I have generally found the PostgreSQL documentation to be superb and one of the great strengths of the project.  But one poster did hit on an issue which I think is entirely legitimate: if you Google something like "PostgreSQL documentation", you get a link to our main documentation.  But if you Google "PostgreSQL ALTER TABLE", you get a link to the documentation for ALTER TABLE in PostgreSQL 8.1, whereas you might hope to get a link to the 8.4 version of the documentation for that command.  And if you Google "PostgreSQL setting", well, let's just say you don't get a link to a page that tells you how to change PostgreSQL settings.  If you actually go to the documentation page and navigate through it manually, it's quite easy to find what you're looking for, but there must be something about our site that make Google fail to grok it properly.&lt;br /&gt;&lt;br /&gt;Still another poster was looking for documentation in Chinese.  Currently, I believe that we maintain documentation only in English due to the rather large translation effort that would be involved in keeping documentation up to date in multiple languages.  In fact, we currently don't even ship Chinese translations of our error messages, due to the fact that &lt;a href="http://babel.postgresql.org/"&gt;our existing set of translations is too incomplete&lt;/a&gt;.  If you would like to help localize PostgreSQL for your native language, please see our wiki page on &lt;a href="http://wiki.postgresql.org/wiki/NLS"&gt;NLS&lt;/a&gt;.  Volunteers are needed!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1718994890339803728?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1718994890339803728/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1718994890339803728' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1718994890339803728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1718994890339803728'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/05/lots-and-lots-of-postgresql-feature.html' title='Lots and Lots of PostgreSQL Feature Requests'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-8194514980762048791</id><published>2010-05-05T12:05:00.000-04:00</published><updated>2010-05-05T12:06:09.845-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Big Ideas</title><content type='html'>Each release of PostgreSQL features dozens, if not hundreds, of small improvements over the previous release; and a few really major new features.  Of course, not everyone will agree on what the best new features are.  In the forthcoming &lt;a href="http://developer.postgresql.org/pgdocs/postgres/release-9-0.html"&gt;9.0&lt;/a&gt; release, pretty much everyone seems to agree that Streaming Replication (standby servers can receive WAL incrementally rather than in 16MB chunks) and Hot Standby (standby servers can execute read-only queries) are the big new features.  In &lt;a href="http://www.postgresql.org/about/press/features84"&gt;8.4&lt;/a&gt;, I think the biggest improvements were the addition of window functions and common table expressions and the self-tuning free space map, which eliminated a major potential source of hassle for database administrators.  In &lt;a href="http://www.postgresql.org/about/press/features83"&gt;8.3&lt;/a&gt;, we got several dramatic performance improvements - HOT, checkpoint spreading, and improvements to the background writer.&lt;br /&gt;&lt;br /&gt;So, what's next?  What should our community be focusing on for PostgreSQL 9.1?  If you've been following developments on &lt;a href="http://archives.postgresql.org/pgsql-hackers/"&gt;pgsql-hackers&lt;/a&gt;, you might be tempted to pick out some of the big patches that weren't completed in time for 9.1, like KNNGIST (use indices to accelerate queries that do ORDER BY &lt;expression&gt; &lt;op&gt; &lt;constant&gt;, as when you want to find, say, the nearest points to a given circle), improved partitioning support (built-in syntax to reduce manual setup), and index-only scans (reduce I/O for index scans by opportunistically skipping or postponing tuple visibility checks).  Another possible source of ideas is to look at the features that will be part of 9.0 and think about ways in which they could be further improved: streaming replication that is synchronous rather than asynchronous, or allowing Hot Standby to pause and resume WAL replay, or narrowing the set of circumstances under which Hot Standby needs to cancel a query in order to proceed with WAL replay.  You could also look at our &lt;a href="http://wiki.postgresql.org/wiki/Todo"&gt;TODO&lt;/a&gt; list, or &lt;a href="http://postgresql.uservoice.com/forums/21853-general"&gt;previous&lt;/a&gt; &lt;a href="http://www.postgresql.org/community/survey.64"&gt;surveys&lt;/a&gt; and &lt;a href="http://petereisentraut.blogspot.com/2009/07/uservoice-votes-have-materialized.html"&gt;blog&lt;/a&gt; &lt;a href="http://it.toolbox.com/blogs/database-soup/postgresql-development-priorities-31886"&gt;postings&lt;/a&gt; on this topic.&lt;br /&gt;&lt;br /&gt;But I think it might be good to step back and look at the problem a bit more broadly.  Ignoring for a minute what people actually are working on, what &lt;span style="font-weight: bold;"&gt;should&lt;/span&gt; they be working on?  Where is PostgreSQL strong as a product and where does it need improvement?  Here are a few things to think about - please leave a comment with your thoughts.&lt;br /&gt;&lt;br /&gt;1. Performance and Scalability.  When I first started using PostgreSQL, the product had a reputation for being slow, principally because of issues relating to VACUUM.  That reputation wasn't entirely justified even back then, and I think we've made enormous progress here in 8.3 and 8.4, but there might be more improvements we can make.  Where are the remaining bottlenecks?  What features can we provide to make better use of machines with lots and lots of RAM, CPU, and/or I/O bandwidth?  Or what if you have more than one machine available?  Are there classes of queries that we don't optimize well, and could do better with?&lt;br /&gt;&lt;br /&gt;2. SQL Features.  We're &lt;a href="http://petereisentraut.blogspot.com/2010/01/missing-features-for-postgresql-sql.html"&gt;pretty close&lt;/a&gt; to having all of the SQL features required by the standard  - and many of the ones that are left are not terribly interesting, which may be why no one has gone to the trouble of implementing them.  Still, there are still a few more things that would be nice to have, including updateable views, &lt;a href="http://rhaas.blogspot.com/2010/04/materialized-views-in-postgresql.html"&gt;materialized views&lt;/a&gt;, &lt;a href="http://rhaas.blogspot.com/2010/04/finding-our-way-to-lateral.html"&gt;LATERAL()&lt;/a&gt;, and global temporary tables  Do you need these features?  Are there other things we're missing?&lt;br /&gt;&lt;br /&gt;3. Indexes and Data Types.  We currently support btree, hash, gin, and gist indices; hash indices are somewhat limited at present because they are not WAL-logged, and therefore can become corrupted after a system crash.  We also support a broad array of datatypes, including all of the usual base types plus user-defined record and enum types, an XML datatype, and the ability to create new datatypes using PostgreSQL's powerful extensibility model.  What else do we need, or what that we already have needs improvement?&lt;br /&gt;&lt;br /&gt;4. Procedural Languages.  Our core distribution includes support for SQL functions and four procedural languages: PL/pgsql, PL/perl, PL/python, and PL/tcl.  Additional languages such as &lt;a href="http://www.joeconway.com/plr/"&gt;PL/R&lt;/a&gt; and the ever-popular &lt;a href="http://pgfoundry.org/projects/pllolcode/"&gt;PL/LOLCODE&lt;/a&gt; are available as extensions.  It seems unlikely to me that we need more procedural lanaguages, but the existing ones might need improvement.&lt;br /&gt;&lt;br /&gt;5. Security.  Security can be further subdivided into connection security (preventing the bad guys from connecting to your database) and database privileges (allowing access to some of the data in the database, but not all of it).  Two major features that we don't have in this are &lt;a href="http://wiki.postgresql.org/wiki/RLS"&gt;row-level security&lt;/a&gt; and &lt;a href="http://wiki.postgresql.org/wiki/SEPostgreSQL"&gt;SE-Linux integration&lt;/a&gt;, but there may be other things as well.  What are they and which ones are important?&lt;br /&gt;&lt;br /&gt;6. Administration.  I think that the simplicity of administering  PostgreSQL is one of its greatest strengths: installing PostgreSQL  doesn't mean that you need to hire a dedicated DBA.  Still, there's  always something that's hard to do.  What is it?&lt;br /&gt;&lt;br /&gt;7. Replication and High Availability.  I alluded to some possible projects in this area near the top of this post, and of course some of our needs in this area will continue to be met by third-party projects, such as &lt;a href="http://www.slony.info/"&gt;Slony&lt;/a&gt;, &lt;a href="http://bucardo.org/"&gt;Bucardo&lt;/a&gt;, and Londiste, but there may be other enhancements needed in the core product, also.&lt;br /&gt;&lt;br /&gt;8. Other Stuff.  What else is there?&lt;/constant&gt;&lt;/op&gt;&lt;/expression&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-8194514980762048791?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/8194514980762048791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=8194514980762048791' title='77 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/8194514980762048791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/8194514980762048791'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/05/big-ideas.html' title='Big Ideas'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>77</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-6700759496472052863</id><published>2010-04-29T16:12:00.000-04:00</published><updated>2010-04-29T13:12:53.425-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Write-Ahead Logging in PostgreSQL 9.0</title><content type='html'>PostgreSQL 9.0 will feature a new setting, currently called wal_level (we still have a ways to go before the final release, so that could change, but probably not), which will control the amount of information written to the system's write-ahead log. There are three levels:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- "minimal" will write just enough information to the log to ensure proper crash recovery.&lt;/div&gt;&lt;div&gt;- "archive" will write enough extra information to support a standby server.&lt;/div&gt;&lt;div&gt;- "hot_standby" will write the same information as "archive", plus enough additional information to allow the standby server to run queries (the feature popularly known as "Hot Standby").&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you're familiar with setting up a standby server in releases prior to 9.0, you may know that this behavior was controlled in 8.4 and prior by setting the configuration variable called "archive_mode".  In 8.4 and prior, archive_mode controls not only the amount of information written to the write-ahead log (WAL), but also whether the archiver process is started and whether unarchived segments are retained on the master.  While this design worked OK for earlier releases, we outgrew it in 9.0 due to the addition of two new features: streaming replication and hot standby.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In 8.4, archive_mode controls three separate behaviors: what information is written to WAL, whether or not to start the archiver process, and whether or not to retain unarchived WAL segments indefinitely.  In 9.0, it's possible to set up a system where streaming replication is enabled but archiving is not, and streaming replication has the same WAL requirements as archiving.  Rather than writing the necessary information to WAL if &lt;b&gt;either&lt;/b&gt; archiving or streaming replication is enabled, it seemed cleaner to have a separate setting to explicitly control what got written to WAL.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;While streaming replication and archiving have essentially the same WAL requirements, Hot Standby requires all of those same things to be logged plus a few more.  Initially, we just had a setting for whether or not to log those few extra things, and it simply didn't do anything unless either archiving or streaming replication was also enabled.  But that led to some confusing error conditions.  Streaming replication was enabled by setting a variable called max_wal_senders to a value greater than 0, so the WAL needed for Hot Standby would get written if:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(archive_mode = 'on' OR max_wal_senders&gt;0) AND recovery_connections='on'&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Again, it seemed cleaner to have a separate setting.  When Hot Standby failed to start on the standby because of incorrect settings on the master, the error message needed to say something like this:&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;We can't start Hot Standby because the master server either has max_wal_senders=0 and archive_mode=off, or else it has recovery_connections=off.  So please either go enable recovery_connections, or if it's already enabled, then either increase max_wal_senders or turn on archive_mode.&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;With the new wal_level setting, we can just say (in effect) this:&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;We can't start Hot Standby because you didn't set wal_level='hot_standby' on the master.&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;That's not the exact text of the error message.  We actually refer to the thing that we can't start on the standby as "recovery_connections", and there is a "recovery_connections" setting on the standby that controls whether or not we try to start it.  I'm not sure whether this is all good terminology - these are all new features so we're hammering it out as we go along!  Hopefully we'll get some further feedback as we move into beta.  Beta1 should be wrapped later today!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-6700759496472052863?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/6700759496472052863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=6700759496472052863' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6700759496472052863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6700759496472052863'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/04/write-ahead-logging-in-postgresql-90.html' title='Write-Ahead Logging in PostgreSQL 9.0'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-8070789292361884622</id><published>2010-04-22T09:24:00.000-04:00</published><updated>2010-04-22T10:28:13.090-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Materialized Views in PostgreSQL</title><content type='html'>About 9 months ago, &lt;a href="http://petereisentraut.blogspot.com/"&gt;Peter Eisentraut&lt;/a&gt; reported on the &lt;a href="http://petereisentraut.blogspot.com/2009/07/uservoice-votes-have-materialized.html"&gt;results of a UserVoice survey&lt;/a&gt; he had set up.  The  purpose of the survey was to gather information from PostgreSQL users on which features they were most interested in seeing added to &lt;a href="http://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt;.  Of course, to what extent the features that got high marks in that survey represent the real interests of the community is questionable: certainly, not every PostgreSQL user (or potential user) reads Peter's blog.  Still, the results seem to indicate a lot of interest in materialized views.&lt;br /&gt;&lt;br /&gt;Recently, Pavel Baros made a &lt;a href="http://archives.postgresql.org/pgsql-hackers/2010-04/msg00479.php"&gt;proposed&lt;/a&gt; a possible implementation of materialized views on the pgsql-hackers mailing list as a &lt;a href="http://code.google.com/soc/"&gt;Google Summer of Code&lt;/a&gt; project.  What he's proposing to do is just about the simplest possible implementation of materialized views I can imagine, comprising just two commands:&lt;br /&gt;&lt;br /&gt;CREATE MATERIALIZED VIEW name AS SELECT ...&lt;br /&gt;ALTER MATERIALIZED VIEW name REFRESH;&lt;br /&gt;&lt;br /&gt;Of course, right away this opens a can of worms.  Basically, there are two things that you might mean when you talk about a "materialized view":&lt;br /&gt;&lt;br /&gt;1. &lt;span style="font-weight: bold;"&gt;A materialized view that is always up to date&lt;/span&gt;.  In other words, whenever the underlying tables are updated, there is some incremental-update process that concurrently modifies the materialized view data so that it remains up to date also.  The tricky part is that it's not easy to update a materialized view of an arbitrary query for a reasonable cost.  If the query is complex, the only feasible way to keep the materialized view up to date may be to re-execute the entire query whenever any of the underlying tables are modified (or when any of the functions or operators are redefined), which is probably not feasible for most people.   But the plus side is that, when a cheap incremental update IS possible, you don't really need to know that you're working with a materialized view at all.  It's indistinguishable from a regular view, up to performance.&lt;br /&gt;&lt;br /&gt;2. &lt;span style="font-weight: bold;"&gt;A materialized view that isn't always up to date&lt;/span&gt;.  This would include the proposed implementation, which is manual-refresh-only, as well as, for example, views that are refreshed on a regular schedule.   (It's pretty easy to convert manual-refresh-only to refreshed-on-a-regular-schedule if you have access to cron!)  Materialized views of this type are possibly useful in cases where incremental refresh isn't easily done, such as aggregates over a huge data set that produce a much smaller output table.  Of course, you can do this kind of thing today using triggers, but maybe it would be nice to have something in the database that would do it for you automatically.&lt;br /&gt;&lt;br /&gt;In the end, I suspect we'll want to support both of these features in PostgreSQL, but I'm curious which one people think is more useful.  Our initial implementation of either feature is likely to be a bit rough around the edges, so don't assume we're going to provide all the optimizations we'd ever like to have on day one!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-8070789292361884622?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/8070789292361884622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=8070789292361884622' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/8070789292361884622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/8070789292361884622'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/04/materialized-views-in-postgresql.html' title='Materialized Views in PostgreSQL'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-1469210749997826791</id><published>2010-04-18T22:07:00.000-04:00</published><updated>2010-04-18T22:52:38.452-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Materialization in PostgreSQL 9.0</title><content type='html'>Some plan types, such as nested loops and, to a lesser degree, merge joins, rely on the ability to "rescan" their inner input.  Rescanning basically means backing up: the executor asks the target node to produce the same output tuples it has already spit out all over again - either all of them, or just a specified portion.  This can be expensive: if the plan that produced those tuples has a high cost associated with it, we'd very much prefer not to do it more than once.&lt;br /&gt;&lt;br /&gt;Enter Materialize.  When considering a Nested Loop or Merge Join, the planner considers inserting a "Materialize" node atop the inner plan.  This node stores a copy of the tuples generated by the inner plan in an in-memory buffer or in a temporary file, making it very cheap to return them over again if needed.&lt;br /&gt;&lt;br /&gt;In versions 8.4 and prior, the logic for inserting Materialize nodes when considering Nested Loop plans is thoroughly bogus.   The planner had no idea that rescanning a Materialize node would be any cheaper than scanning it the first time - which is pretty horrible when you consider that this is precisely the point of having Materialize nodes.  In 9.0, the logic has been extensively &lt;a href="http://archives.postgresql.org/pgsql-committers/2009-09/msg00121.php"&gt;rewritten&lt;/a&gt;.  Based on the limited testing I've done so far, 9.0 will materialize the inner side of a nested loop a great deal more frequently than 8.4, and most of those cases seem to be wins.&lt;br /&gt;&lt;br /&gt;It's probably not too surprising that if the node being rescanned is, say, a join, it's faster to reread the tuples from a buffer than it is to redo the whole join.  Similarly, if you're rescanning a base table with a filter condition - e.g. find all the rows in table foo where x = 1 - it's faster to save the rows that meet the condition than it is to rescan the whole table and test the condition over again for each row.  Amazingly, however, at least in some cases, it seems to be faster to use materialization even when rescanning a base table WITHOUT a filter condition.  In other words, if we need to read all the rows in table foo three times, it's at least sometimes faster to read the table once, dump all the tuples into a tuplestore, and then reread the tuplestore twice more than it is to read the base table three times.&lt;br /&gt;&lt;br /&gt;How is that possible, you ask?  I haven't played with this enough to be sure, but I suspect the win comes from eliminating tuple visibility checks and other overhead.&lt;br /&gt;&lt;br /&gt;Even though this isn't the sort of feature that tends to make the headlines, it's a fairly significant adjustment to the planner, so I expect to find some lurking problems (a few have been found and fixed already).  It may be that the planner is now too aggressive at materializing, whereas before it seems it wasn't aggressive enough.  Or it may turn out that materializing increases query memory usage too much, or just isn't faster in some as-yet-unknown set of cirumstances.  On the whole, though, the new logic is far more sensible than the old logic, so I'm hopeful that we'll seem some modest performance improvements out of this change once the dust settles.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-1469210749997826791?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/1469210749997826791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=1469210749997826791' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1469210749997826791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/1469210749997826791'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/04/materialization-in-postgresql-90.html' title='Materialization in PostgreSQL 9.0'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-6972864064540649718</id><published>2010-04-14T20:29:00.000-04:00</published><updated>2010-04-16T07:11:08.952-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Finding Our Way to LATERAL</title><content type='html'>One of the few types of SQL query that we don't yet implement in PostgreSQL is LATERAL, and we seem to get fairly regular requests for it.  The typical use case for this feature is where you have a table called, say, foo, and a set-returning function called, say, func, and you'd like to do this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;SELECT foo.x, bar.x FROM foo, func(foo.x) AS bar;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;But that doesn't work:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;ERROR:  function expression in FROM cannot refer to other relations of same query level&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;In fact, the SQL standard apparently specifies that this is not legal syntax.  If you want to reference a variable at the same query level, you need to wrap it using LATERAL():&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;SELECT foo.x, bar.x FROM foo, LATERAL(func(foo.x)) AS bar;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Currently, PostgreSQL does not support LATERAL(), so this query fails with a complaint that there's no function called LATERAL available.  But wouldn't it be neat if it worked?  We get requests for this feature pretty regularly.  Right now, there's a pretty limited number of ways to call SRFs, and it's hard to get the equivalent of the above query without major gymnastics.&lt;br /&gt;&lt;br /&gt;I wanted to see how much work it would be to implement LATERAL() in PostgreSQL, so, just for fun, I &lt;a href="http://archives.postgresql.org/pgsql-hackers/2009-09/msg00292.php"&gt;beat the parser with a large enough sledgehammer&lt;/a&gt; to make it accept the first of the two queries listed above.  This effort was doomed to failure, however.  When the planner goes to join foo to func(foo.x), it doesn't understand the implicit dependency between those two items.  By jiggering the costs, you can get the planner to decide on a nonsensical plan like this: for each row in the output of func(foo.x), scan all the rows in foo.  Of course, to us human beings, it's obvious that we have to do those two steps in the opposite order, but the planner doesn't know that.  Its only knowledge about the connection between different tables comes from the join clauses, and there are no join clauses in this query.&lt;br /&gt;&lt;br /&gt;As it turns out, fixing this turns out to be closely related to solving a problem with nested-loop-with-inner-indexscan plans, which could more generally be called "partial index scan" plans.  Currently, we find these plans using some special case crocks that cover most, but not quite all, of the interesting cases.  Andrew Gierth supplied &lt;a href="http://archives.postgresql.org/pgsql-hackers/2009-09/msg00525.php"&gt;this example&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;SELECT ... FROM t1 LEFT JOIN (t2 JOIN t3 ON (t2.a=t3.a)) on (t1.a=t2.a);&lt;br /&gt;&lt;/pre&gt;If t1 is small and t2 and t3 are large, we might like to get a plan that looks something like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Nested Loop Left Join&lt;br /&gt;Join Filter: (t1.a = t2.a)&lt;br /&gt;-&gt; Seq Scan on t1&lt;br /&gt;-&gt; Nested Loop&lt;br /&gt; Join Filter: (t2.a = t3.a)&lt;br /&gt;   -&gt; Index Scan using t2_a on t2&lt;br /&gt;      Index Qual: (t2.a = t1.a)&lt;br /&gt;   -&gt; Index Scan using t3_a on t3&lt;br /&gt;      Index Qual: (t3.a = t1.a)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;But we won't.  Instead, we'll spend a lot of energy joining all of t2 to all of t3, and then throw away those results when we do the join to t1.  This happens because planner will only consider a partial index scan on t2 or t3 if the index scan is the inner side of a nested loop and the table providing the value to look for is on the outer side of the same nested loop.  Here, the index quals are referencing t1, which isn't part of the join: it's one level up.  In many cases, the planner can work around the inability to form these types of plans by reordering the joins, but swapping the order of the LEFT and INNER joins in this query would change it's meaning, so that doesn't work in this case.&lt;br /&gt;&lt;br /&gt;Tom Lane had an idea about how to &lt;a href="http://archives.postgresql.org/pgsql-hackers/2009-10/msg00994.php"&gt;generalize the inner-indexscan machinery&lt;/a&gt; to handle this.  Instead of considering partial index scans using special-case logic at the time we form a nested loop, Tom proposed, essentially, promoting them to first-class citizens, to be considered along with all the other paths we examine when forming a join.  To make that work, a little bit of tracking data must be added: if we choose a partial index scan path for t2, we don't need to join it directly to t1, but we do need to *eventually* put whichever portion of the plan contains it on the inner side of a nested loop that has t1 on the outer side, so that t1 can supply the values for the index lookup.  As it happens, set-returning functions called via LATERAL need exactly the same thing: a way to make sure that the portion of the query tree where they end up being called is somewhere under the inner side of a nested loop whose outer side supplies the necessary variables.&lt;br /&gt;&lt;br /&gt;There's one more fly in the ointment: this is not just a planning problem.  We also need to make sure that whatever plan the planner creates can be executed by the executor.  It turns out that the executor has an almost identical limitation.  Nested loops pass down an "outer tuple" to their inner plan, and if that plan happens to be an index scan then the outer tuple can be used to constrain the index lookup.   Unfortunately, again, this only works if the nested loop immediate parent of the index scan.  Tom Lane has &lt;a href="http://archives.postgresql.org/pgsql-hackers/2009-12/msg01755.php"&gt;an idea for fixing this&lt;/a&gt;, too: replace the existing mechanism with executor parameters, which are more general and can pass values between far-distant parts of the query plan.  Again, we'll use this same design for LATERAL, when a set-returning function has input parameters that must be supplied by a table scan elsewhere in the query.&lt;br /&gt;&lt;br /&gt;So, when might we see actual LATERAL support in PostgreSQL?  Tom Lane has indicated that he plans to fix the executor limitation described above for 9.1; I'm not sure whether he's planning to fix the planner limitation as well.  Once those are fixed, I think we'll be within striking distance of the core feature.  So, I'm hopeful that we'll get LATERAL in either 9.1 or 9.2.  Stay tuned!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-6972864064540649718?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/6972864064540649718/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=6972864064540649718' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6972864064540649718'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/6972864064540649718'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/04/finding-our-way-to-lateral.html' title='Finding Our Way to LATERAL'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20038672.post-7951042989903888074</id><published>2010-04-12T22:33:00.000-04:00</published><updated>2010-04-12T20:28:35.478-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>PostgreSQL East 2010 Slides</title><content type='html'>Quite a few people seemed to like my talk on the &lt;a href="http://postgresqlconference.org/2010/east/talks/postgresql_query_planner"&gt;PostgreSQL Query Planner&lt;/a&gt; at &lt;a href="http://www.postgresqlconference.org/2010/east/"&gt;PostgresSQL East&lt;/a&gt;, and I got a few requests for copies of my slides.  I'll be giving a shortened version of that talk at &lt;a href="http://www.pgcon.org/2010/"&gt;PGcon 2010&lt;/a&gt;.  I didn't get as many positive comments on other talk, an &lt;a href="http://postgresqlconference.org/2010/east/talks/introduction_to_triggers"&gt;Introduction to Triggers&lt;/a&gt;, though I had a pretty full room and the people who came seemed to find the material interesting.  Anyhow, I've &lt;a href="http://sites.google.com/site/robertmhaas/presentations"&gt;put both presentations on line&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20038672-7951042989903888074?l=rhaas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rhaas.blogspot.com/feeds/7951042989903888074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=20038672&amp;postID=7951042989903888074' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/7951042989903888074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20038672/posts/default/7951042989903888074'/><link rel='alternate' type='text/html' href='http://rhaas.blogspot.com/2010/04/postgresql-east-2010-slides.html' title='PostgreSQL East 2010 Slides'/><author><name>Robert Haas</name><uri>http://www.blogger.com/profile/08393677427643988650</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://4.bp.blogspot.com/_ojH_sidvpb0/TNhrPknv9fI/AAAAAAAAABQ/6pW9WOHuC5g/S220/Robert+Haas+-+Head+Shot.JPG'/></author><thr:total>1</thr:total></entry></feed>
