Re: using extended statistics to improve join estimates - Mailing list pgsql-hackers

From Andrei Lepikhov
Subject Re: using extended statistics to improve join estimates
Date
Msg-id 5c9a1eee-c8ac-408b-95c4-ff388e5e12f0@postgrespro.ru
Whole thread Raw
In response to Re: using extended statistics to improve join estimates  (Andy Fan <zhihuifan1213@163.com>)
Responses Re: using extended statistics to improve join estimates
List pgsql-hackers
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




pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: First draft of PG 17 release notes
Next
From: David Rowley
Date:
Subject: Re: Minor fixes for couple some comments around MERGE RETURNING