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


Reply via email to