Re: partition table optimizer join cost misestimation - Mailing list pgsql-performance

From Andrei Lepikhov
Subject Re: partition table optimizer join cost misestimation
Date
Msg-id e79d93fa-44b6-49d6-9761-5cffa59930c6@gmail.com
Whole thread Raw
In response to Re: partition table optimizer join cost misestimation  (James Pang <jamespang886@gmail.com>)
List pgsql-performance
On 4/3/25 02:46, James Pang wrote:
> Andrei,
>     Yes, from explain output, since optimizer already get the 
> merge_append cost but not take account into total cost, that make a big 
> difference.  I shared table DDLs and explain analyze,buffers output , I 
> think  the data maybe generated by other way to reproduce this issue. 
> sorry for not sharing the commercial production data here.
I think it is almost enough to identify the issue. Let me ask you the 
following questions:
1. Can you provide min and max values in columns cc.sss_id and aa.mmm_id?
2. How often do you analyze your *parent* tables tablea and tablec? 
Remember, if you want to build statistics on a partitioned table (not a 
partition), you have to explicitly call

ANALYZE tablea,tablec;

mentioning these tables in the analyze list.

3. May you provide a dump of pg_statistic on attributes cc.sss_id and 
aa.mmm_id?
4. Is there a possibility of changing a single code line and rebuilding 
your DB instance to check a conjecture?

-- 
regards, Andrei Lepikhov



pgsql-performance by date:

Previous
From: James Pang
Date:
Subject: Re: partition table optimizer join cost misestimation
Next
From: Chris Joysn
Date:
Subject: Fwd: Very slow query performance when using CTE