On Mon, Sep 1, 2025 at 3:00 PM Richard Guo <guofenglinux@gmail.com> wrote:
> 0001 has been pushed; here is a rebase of 0002.
>
> I think the additional call to eval_const_expressions() is acceptable
> performance-wise, because 1) it only runs when index expressions or
> predicates are present, and 2) it's relatively cheap when run on small
> expression trees, which is typically the case for index expressions
> and predicates. In return, in cases such as the reported, it enables
> the planner to match and use partial indexes, which can be a big win
> in execution.
Here is an updated version of the patch. In the commit message, I've
explained why I think the additional call to eval_const_expressions is
not a performance concern. I've also added a test case to validate
that NullTest quals in index expressions can now be reduced.
One concern I have is that this fix can only be applied to master;
there's no way to backpatch it to v17 or v18. This means that the
issue won't exist in v16 or earlier, nor in v19 and later, but it will
persist in v17 and v18. I have no idea what we should do for v17 and
v18.
- Richard