Allan Wang <allanvv(at)gmail(dot)com> writes:
> It seems that Postgres is estimating that all rows in a 50k row table
> will be returned, but only one should match.
I think this is the same issue fixed here:
2005-04-03 21:43 tgl
* src/backend/optimizer/path/: costsize.c (REL7_4_STABLE),
costsize.c (REL8_0_STABLE), costsize.c: In cost_mergejoin, the
early-exit effect should not apply to the outer side of an outer
join. Per andrew(at)supernews(dot)
Are you running 7.4.8 or 8.0.2 or later?
regards, tom lane