Re: Simple query with Planner underestimating rows.

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: Felipe López Montes <xocas89(at)gmail(dot)com>
Cc: "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Simple query with Planner underestimating rows.
Date: 2025-01-29 08:57:15
Message-ID: 0b75eb10-5a48-4bea-a5d1-898c52dcb932@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Clemens Eisserer 2025-01-29 12:07:54 Re: Why ORing with a false one-time filter turns an Index-Lookup into a SeqScan
Previous Message Andrei Lepikhov 2025-01-29 03:05:50 Re: Simple query with Planner underestimating rows.