"Jonathan Ellis" <jonathan@xxxxxxxxxxxxxx> writes: > It was in my original post unless it got clipped: Sorry, I had forgotten. > The problem seems to be that clan_members_v contains a call to an > expensive function: I'll bet that the function is marked VOLATILE. 8.2 is more conservative about optimizing away volatile functions than previous releases. If it has no side effects, mark it STABLE (or can it even be IMMUTABLE?). In some quick testing, I verified that 8.2 does evaluate the function at the join level corresponding to the view's join (and I think this is preventing it from considering other join orders, too). If you change the function's marking to be nonvolatile then the function disappears from the plan entirely, and also it seems to prefer joining "clans" sooner. regards, tom lane