public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andrey Lepikhov <[email protected]>
To: Tom Lane <[email protected]>
To: [email protected]
Subject: Re: eqjoinsel_semi still sucks ...
Date: Fri, 23 Jun 2023 14:28:55 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
On 2/5/2012 20:34, Tom Lane wrote:
> On reflection I think that the idea of clamping ndistinct beforehand is
> just wrong, and what we ought to do instead is apply a multiplier to the
> selectivity estimate afterwards. In the case of a base rel we could
> just multiply by the selectivity of its baserestrictinfo list. For join
> rels it's a bit harder to guess how much a given input relation might
> have been decimated, but if the join's estimated size is smaller than
> the output size of the base rel the correlation var came from, we could
> multiply by that ratio (on top of whatever correction came from the base
> rel's restriction clauses).
I got stuck in some cases where (due to a tree of filters) the planner
underestimates the JOIN just because the ndistinct conveys a huge number
to the selectivity estimation formula. However, the estimation of both
input relations is made correctly and is limited.
I've tried to understand the logic through commits 0d3b231eebf,
97930cf578e and 7f3eba30c9d. But it is still not clear.
So, why the idea of clamping ndistinct is terrible in general? Could you
explain your reasons a bit more?
--
regards,
Andrey Lepikhov
Postgres Professional
view thread (2+ messages)
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: eqjoinsel_semi still sucks ...
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox