Re: BUG #17540: Prepared statement: PG switches to a generic query plan which is consistently much slower

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, william.duclot@gmail.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2023-07-10T06:39:27Z
Lists: pgsql-bugs, pgsql-hackers

Attachments

On Mon, Jul 10, 2023 at 10:14 AM David Rowley <dgrowleyml@gmail.com> wrote:

> On Fri, 7 Jul 2023 at 19:03, Richard Guo <guofenglinux@gmail.com> wrote:
> > Attached is what I have in mind.  The patch extends the logic from two
> > points.
> >
> > * it also checks OR clauses to see if it is always true.
> >
> > * it also checks for join clauses by additionally testing if the nulling
> > bitmap is empty.
>
> Do you mind writing some regression tests for this?
>
> I don't really see an existing test file that would suit, maybe it's
> worth adding something like predicate.sql


Here is v3 patch with regression tests.  I add the new test into the
group where stats test is in, but I'm not sure if this is the right
place.

Thanks
Richard

Commits

  1. Add better handling of redundant IS [NOT] NULL quals