Re: Question about Expected rows value in EXPLAIN output for Nested Loop node - Mailing list pgsql-general

From Tom Lane
Subject Re: Question about Expected rows value in EXPLAIN output for Nested Loop node
Date
Msg-id 32178.1557589638@sss.pgh.pa.us
Whole thread Raw
In response to Re: Question about Expected rows value in EXPLAIN output for Nested Loop node  (bb ddd <nnickoloff1234@abv.bg>)
List pgsql-general
bb ddd <nnickoloff1234@abv.bg> writes:
> Thanks, Adrian, but i was looking for something that goes into more depth.

Use the source, Luke.

git clone git://git.postgresql.org/git/postgresql.git

Likely places to look for this purpose include

src/backend/optimizer/README
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/clausesel.c
src/backend/utils/adt/selfuncs.c

The short answer to your question is that no, the size of the join
relation is not estimated by multiplying the sizes of input paths
for some particular nestloop plan.  The join size estimate is made
first and the same size is applied to all paths for the join.

In the case of a nestloop where the entire join condition was pushed
into the RHS path, you'd ideally expect that the LHS size times the
estimated size of the filtered RHS path matches the previously-made
join size estimate ... but those are different code paths using
different estimators, and since this is all very approximate and
full of heuristic guesses, sometimes they don't match very well.

            regards, tom lane



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: perl path issue
Next
From: Jeremy Schneider
Date:
Subject: Re: Hot Standby Conflict on pg_attribute