Re: Why does row estimation on nested loop make no sense to me

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Jeff Amiel <becauseimjeff(at)yahoo(dot)com>
Cc: "depesz(at)depesz(dot)com" <depesz(at)depesz(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Why does row estimation on nested loop make no sense to me
Date: 2013-05-20 14:41:02
Message-ID: CA+HiwqFcH+TuUM57vBXpsfWD8sgYuse06VSC7JyTzp=80vyhiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, May 20, 2013 at 11:01 PM, Jeff Amiel <becauseimjeff(at)yahoo(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Amit Langote 2013-05-20 14:51:41 Re: Why does row estimation on nested loop make no sense to me
Previous Message Merlin Moncure 2013-05-20 14:16:40 Re: Deploying PostgreSQL on CentOS with SSD and Hardware RAID