From: | Andrei Lepikhov <lepihov(at)gmail(dot)com> |
---|---|
To: | Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>, pgsql-performance(at)lists(dot)postgresql(dot)org |
Subject: | Re: inefficient/wrong plan cache mode selection for queries with partitioned tables (postgresql 17) |
Date: | 2025-05-12 12:08:21 |
Message-ID: | b7da2330-1054-4bb8-939a-cb05d377f70f@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On 5/12/25 13:49, Maxim Boguk wrote:
> I suspect this situation should be quite common with queries over
> partitioned tables (where planning time is usually quite a high).
>
> Any suggestions what could be done there outside of using
> force_generic_plan for a particular db user (which will kill performance
> in other queries for sure)?
Thanks for this puzzle!
I suppose, in case generic planning is much faster than custom one,
there are two candidates exist:
1. Touching the index during planning causes too much overhead - see
get_actual_variable_range
2. You have a massive default_statistics_target for a table involved.
So, to clarify the problem, may you provide EXPLAIN (without analyze)
with BUFFERS ON ?
Also, could you provide extra information on the statistics involved?
For each column (I think created_at is the most important one), show the
size of MCV and histogram arrays.
--
regards, Andrei Lepikhov
From | Date | Subject | |
---|---|---|---|
Next Message | Maxim Boguk | 2025-05-12 13:08:09 | Re: inefficient/wrong plan cache mode selection for queries with partitioned tables (postgresql 17) |
Previous Message | Maxim Boguk | 2025-05-12 11:49:10 | inefficient/wrong plan cache mode selection for queries with partitioned tables (postgresql 17) |