On Thu, 2007-10-04 at 08:30 -0400, Alvaro Herrera wrote:
> Henrik wrote:
>
> > Ahh I had exactly 8 joins.
> > Following your suggestion I raised the join_collapse_limit from 8 to 10 and
> > the planners decision sure changed but now I have some crazy nested loops.
> > Maybe I have some statistics wrong?
>
> Yeah. The problematic misestimation is exactly the innermost indexscan,
> which is wrong by two orders of magnitude:
Nested Loops are evil.. and I've no clue on why PG has such big
mis-estimates. Mine are like 1:500
I've solved mine using SRFs