For the second time in a few weeks I have had to resort to some ugly manipulation of server settings to get a query to run faster. In both cases the problem has been that a merge join has been preferred over a much faster nested loop or hash join. It's results like these that lead to people calling for explicit planner hints. I understand the reason for us not doing so, but the end result is that people use their own workarounds which are almost always uglier and suffer the same defects as planner hints.
At least I know that the real fix to the query planner should be shared to the upstream code soon <img src="/andrew/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" />