Re: Why does row estimation on nested loop make no sense to me - Mailing list pgsql-general

From Amit Langote
Subject Re: Why does row estimation on nested loop make no sense to me
Date
Msg-id CA+HiwqFcH+TuUM57vBXpsfWD8sgYuse06VSC7JyTzp=80vyhiw@mail.gmail.com
Whole thread Raw
In response to Re: Why does row estimation on nested loop make no sense to me  (Jeff Amiel <becauseimjeff@yahoo.com>)
Responses Re: Why does row estimation on nested loop make no sense to me
List pgsql-general
On Mon, May 20, 2013 at 11:01 PM, Jeff Amiel <becauseimjeff@yahoo.com> 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


pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Deploying PostgreSQL on CentOS with SSD and Hardware RAID
Next
From: Amit Langote
Date:
Subject: Re: Why does row estimation on nested loop make no sense to me