"Scott Carey" <scott(at)richrelevance(dot)com> writes:
> Certainly, a cost estimate that is ... LESS than one of the sub sections of
> the query is wrong. This was one hell of a broken query, but it at least
> should have taken an approach that was not a nested loop, and I'm curious if
> that choice was due to a bad estimate here.
>
> Nested Loop IN Join (cost=0.00..3850831.86 rows=128266 width=8)
Because it's an IN join it doesn't have to run the inner join to completion.
Once it finds a match it can return the outer tuple and continue to the next
outer tuple.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's 24x7 Postgres support!