Re: BUG #15160: planner overestimates number of rows in join when there are more than 200 rows coming from CTE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: alexey(dot)ermakov(at)dataegret(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15160: planner overestimates number of rows in join when there are more than 200 rows coming from CTE
Date: 2018-04-17 14:15:38
Message-ID: 15035.1523974538@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

=?utf-8?q?PG_Bug_reporting_form?= <noreply(at)postgresql(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Emre Hasegeli 2018-04-17 15:14:05 Re: Standby corruption after master is restarted
Previous Message PG Bug reporting form 2018-04-17 13:35:06 BUG #15161: libpq - Invalid SSPI context after PQreset

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-04-17 14:26:16 Re: Proposal: Adding json logging
Previous Message Arthur Zakirov 2018-04-17 14:14:12 Re: [HACKERS] proposal: schema variables