Re: BUG #19357: PostgreSQL generates a custom plan that performs worse than the generic plan for a certain query. - Mailing list pgsql-bugs

From ZhangChi
Subject Re: BUG #19357: PostgreSQL generates a custom plan that performs worse than the generic plan for a certain query.
Date
Msg-id tencent_2A825DEBCCCF93399A24C409873A2FE5EF0A@qq.com
Whole thread Raw
In response to Re: BUG #19357: PostgreSQL generates a custom plan that performs worse than the generic plan for a certain query.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Hi Tom Lane,

I strongly agree with your point. My objective is not to make PostgreSQL capable of optimizing all queries. My intention is simply to note that, for this test case, PostgreSQL is fully capable of optimizing the query, as demonstrated by the generic plan. However, I am unsure why the performance of the custom plan actually degrades. I believe that understanding the reasons behind this performance degradation (or suboptimality) could be important. This facilitates PostgreSQL’s selection of the optimal query plan.

Best,
Chi

Original

From: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2025-12-17 23:39
To: Greg Sabino Mullane <htamfids@gmail.com>
Cc: 798604270 <798604270@qq.com>, pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #19357: PostgreSQL generates a custom plan that performs worse than the generic plan for a certain query.

Greg Sabino Mullane <htamfids@gmail.com> writes:
> Please simplify your test query as much as possible and use "text" format
> in your explain results; those will improve your chances of getting a
> useful reply. :)

More to the point: it's hard to get excited about optimizing a query
that was so obviously built by a fuzzer rather than corresponding to
any real-world use-case.  We have finite manpower and we'd much rather
put it into solving users' real problems.

regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #19350: Short circuit optimization missed when runningsqlscriptes in JDBC
Next
From: Pavel Stehule
Date:
Subject: Re: BUG #19357: PostgreSQL generates a custom plan that performsworse than the generic plan for a certain query.