Redundant restriction checks in apply_child_basequals

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Redundant restriction checks in apply_child_basequals
Date: 2026-02-19 07:36:00
Message-ID: CAMbWs4-vLmGXaUEZyOMacN0BVfqWCt2tM-eDVWdDfJnOQaauGg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While working on bug #19412 [1], I noticed $subject. For each child
qual translated from a parent rel's qual, apply_child_basequals calls
eval_const_expressions to simplify it, and then calls
restriction_is_always_false and restriction_is_always_true immediately
afterward to reduce NullTest expressions. Since the planner performs
NullTest deduction during constant folding, I think the call to
restriction_is_always_false and restriction_is_always_true is now
redundant and wastes CPU cycles.

Attached is a patch to remove them.

[1] https://postgr.es/m/19412-1d0318089b86859e@postgresql.org

- Richard

Attachment Content-Type Size
v1-0001-Remove-redundant-restriction-checks-in-apply_chil.patch application/octet-stream 4.4 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2026-02-19 07:55:03 Re: WIP - xmlvalidate implementation from TODO list
Previous Message Kirill Reshke 2026-02-19 07:21:45 Re: add assertion for palloc in signal handlers