On Mon, May 20, 2013 at 11:01 PM, Jeff Amiel <becauseimjeff@xxxxxxxxx> wrote: > Ok - I agree - > > Can somebody help me understand where the row estimates come from on a nested-loop operation in postgres then? > In case you haven't noticed already in the documentation, there are following lines: "... It might appear from inspection of the EXPLAIN output that the estimate of join rows comes from 50 * 1, that is, the number of outer rows times the estimated number of rows obtained by each inner index scan on tenk2. But this is not the case: *the join relation size is estimated before any particular join plan has been considered*. If everything is working well then the two ways of estimating the join size will produce about the same answer, but due to roundoff error and other factors they sometimes diverge significantly." Read more at: http://www.postgresql.org/docs/9.2/static/row-estimation-examples.html It also refers where in source code these table size estimations are done. Hope this helps. -- Amit Langote -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general