Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
> It's basically converted it into a three way join.
More to the point, an *unconstrained* join between "claimsum2001
as claimsum2001" and the intended joined table. The reason it
ran for so long was it was generating a huge number of rows ---
as many as would be in the cross product.
regards, tom lane