On 5/23/24 09:04, Andy Fan wrote:
> Andrei Lepikhov <a.lepikhov@postgrespro.ru> writes:
>> * c) No extended stats with MCV. If there are multiple join clauses,
>> * we can try using ndistinct coefficients and do what eqjoinsel does.
>
> OK, I didn't pay enough attention to this comment before. and yes, I get
> the same conclusion as you - there is no implementation of this.
>
> and if so, I think we should remove the comments and do the
> implementation in the next patch.
I have an opposite opinion about it:
1. distinct estimation is more universal thing - you can use it
precisely on any subset of columns.
2. distinct estimation is faster - it just a number, you don't need to
detoast huge array of values and compare them one-by-one.
So, IMO, it is essential part of join estimation and it should be
implemented like in eqjoinsel.
> Do you think the hook proposal is closely connected with the current
> topic? IIUC it's seems not. So a dedicated thread to explain the problem
> to slove and the proposal and the follwing discussion should be helpful
> for both topics. I'm just worried about mixing the two in one thread
> would make things complexer unnecessarily.
Sure.
--
regards,
Andrei Lepikhov
Postgres Professional