public inbox for [email protected]
help / color / mirror / Atom feedFrom: Laurenz Albe <[email protected]>
To: Attila Soki <[email protected]>
To: Andrei Lepikhov <[email protected]>
Cc: [email protected]
Subject: Re: unstable query plan on pg 16,17,18
Date: Thu, 26 Feb 2026 21:53:57 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
On Thu, 2026-02-26 at 17:15 +0100, Attila Soki wrote:
> Increasing the statistics of dp_end_dat did not helped. With statistic 1000
> I was not able to get a good plan without setting join_collapse_limit=7
Reducing "join_collapse_limit" dumbs down the optimizer, so you are getting a good plan
by accident. I mean, you can try to rewrite the query so that the tables are written
in the order in which they should be joined in the good plan, then set "join_collapse_limit"
to 1. That may be a solution if you cannot find a better one.
Still, the bad estimate that I indicated in [1] is worrysome, and I don't quite
understand it. Could you show the result of the simplified query that I suggested?
EXPLAIN (ANALYZE, BUFFERS, SETTINGS)
SELECT * FROM schema1.table_k AS kal
WHERE dp_end_dat < current_date;
If I were you, I'd focus on getting PostgreSQL to estimate that correctly.
Yours,
Laurenz Albe
[1]: https://postgr.es/m/b2e372392b8a022da81b95b7c823a5729d7fd70f.camel%40cybertec.at
view thread (25+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: unstable query plan on pg 16,17,18
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox