pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: bb ddd <nnickoloff1234@abv.bg>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Question about Expected rows value in EXPLAIN output for Nested Loop node
Date: Sat, 11 May 2019 11:47:18 -0400
Message-ID: <32178.1557589638@sss.pgh.pa.us> (raw)
In-Reply-To: <288922811.129669.1557567206864@nm62.abv.bg>
References: <1078310664.976303.1557490584037@nm63.abv.bg>
	<302576964.978332.1557491557322@nm63.abv.bg>
	<7ad0fba4-73b3-1459-93a7-a30cdcbb5bb9@aklaver.com>
	<2072988616.995164.1557503801848@nm63.abv.bg>
	<f81393b9-6a49-60a5-0de3-d35996c81939@aklaver.com>
	<288922811.129669.1557567206864@nm62.abv.bg>

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





view thread (8+ messages)

Message-ID: <32178.1557589638@sss.pgh.pa.us>
Permalink:  ../32178.1557589638@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/32178.1557589638@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, nnickoloff1234@abv.bg, adrian.klaver@aklaver.com
  Subject: Re: Question about Expected rows value in EXPLAIN output for Nested Loop node
  In-Reply-To: <32178.1557589638@sss.pgh.pa.us>
  References: <1078310664.976303.1557490584037@nm63.abv.bg> <302576964.978332.1557491557322@nm63.abv.bg> <7ad0fba4-73b3-1459-93a7-a30cdcbb5bb9@aklaver.com> <2072988616.995164.1557503801848@nm63.abv.bg> <f81393b9-6a49-60a5-0de3-d35996c81939@aklaver.com> <288922811.129669.1557567206864@nm62.abv.bg> <32178.1557589638@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox