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