Re: partition table optimizer join cost misestimation

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: James Pang <jamespang886(at)gmail(dot)com>, pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: partition table optimizer join cost misestimation
Date: 2025-04-03 06:32:44
Message-ID: e79d93fa-44b6-49d6-9761-5cffa59930c6@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Chris Joysn 2025-04-03 07:20:40 Fwd: Very slow query performance when using CTE
Previous Message James Pang 2025-04-03 00:46:28 Re: partition table optimizer join cost misestimation