Re: Simple query with Planner underestimating rows. - Mailing list pgsql-performance

From Andrei Lepikhov
Subject Re: Simple query with Planner underestimating rows.
Date
Msg-id 0b75eb10-5a48-4bea-a5d1-898c52dcb932@gmail.com
Whole thread Raw
In response to Re: Simple query with Planner underestimating rows.  (Andrei Lepikhov <lepihov@gmail.com>)
List pgsql-performance
On 1/29/25 15:32, Felipe López Montes wrote:
> Hi,
> 
> Thank you for your reply,
> 
> I have already tried creating such statistics on t3.programme_identifier 
> and t3.participant_identifier and the plan is the same, however I cannot 
> create them for the right part of the join as they are from different 
> tables (t1 and t2)
Of course, because for now, a join clause can't be estimated by extended 
statistics. It applies only to a scan filter (clause referencing only 
one relation).
I have meant that with the development patch [1] applied, you may create 
two statistics on t3(participant_identifier,programme_identifier) and 
t2(participant_identifier,programme_identifier). These statistics would 
then be used to estimate the join clause and may resolve the problem.

[1] using extended statistics to improve join estimates
https://www.postgresql.org/message-id/flat/c8c0ff31-3a8a-7562-bbd3-78b2ec65f16c%40enterprisedb.com

-- 
regards, Andrei Lepikhov



pgsql-performance by date:

Previous
From: Andrei Lepikhov
Date:
Subject: Re: Simple query with Planner underestimating rows.
Next
From: Clemens Eisserer
Date:
Subject: Re: Why ORing with a false one-time filter turns an Index-Lookup into a SeqScan