From: Tom Lane <tgl@sss.pgh.pa.us>
To: alexey.ermakov@dataegret.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15160: planner overestimates number of rows in join when there are more than 200 rows coming from CTE
Date: Tue, 17 Apr 2018 10:15:38 -0400
Message-ID: <15035.1523974538@sss.pgh.pa.us> (raw)
In-Reply-To: <152395805004.19366.3107109716821067806@wrigleys.postgresql.org>
References: <152395805004.19366.3107109716821067806@wrigleys.postgresql.org>
=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> I'm wondering how planner estimates number of rows in that case:
See eqjoinsel_semi, particularly the change in behavior when it thinks
nd2 is or is not a default estimate.
Given the lack of statistics about the output of the WITH clause,
it's hard to see how we'd ever get trustworthy estimates here.
I think the fact that your first example yields an accurate
estimate is mostly luck.
regards, tom lane
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, alexey.ermakov@dataegret.com
Subject: Re: BUG #15160: planner overestimates number of rows in join when there are more than 200 rows coming from CTE
In-Reply-To: <15035.1523974538@sss.pgh.pa.us>
References: <152395805004.19366.3107109716821067806@wrigleys.postgresql.org> <15035.1523974538@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