| From: | Thom Brown <thom(at)linux(dot)com> |
|---|---|
| To: | Richard Guo <guofenglinux(at)gmail(dot)com> |
| Cc: | Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Fix HAVING-to-WHERE pushdown with mismatched operator families |
| Date: | 2026-05-28 10:47:04 |
| Message-ID: | CAA-aLv51LO37+d6UTKgG+V7unPqaBjGmZmncePe49=2_QMrEHw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, 27 May 2026, 00:04 Richard Guo, <guofenglinux(at)gmail(dot)com> wrote:
> On Tue, May 26, 2026 at 11:06 PM Thom Brown <thom(at)linux(dot)com> wrote:
> > Makes sense to me, but out of curiosity, while digging into these
> > opfamily mismatches, have you noticed if this same record_ops vs
> > record_image_ops inequality poses any risks to other optimisation
> > paths like window function pushdowns or partition pruning? And
> > apologies if that has already been discussed, but I couldn't find
> > mention of it.
>
> Thanks for raising these points. For partition pruning,
> match_clause_to_partition_key() already checks both collation and
> opfamily compatibility, so I don't think it has similar issues. I'm
> not sure what is meant by "window function pushdowns", but your
> question prompted me to look around, and I did notice that pushing
> restriction clauses down into a subquery suffers from a similar
> problem, specifically, when the subquery has DISTINCT, DISTINCT ON, or
> a window PARTITION BY clause.
>
Yeah, sorry, that wording wasn't clear. I just meant pushing a qual down
past a window function's PARTITION BY, which is the one case the planner
allows. Looks like that's exactly the rank() case you turned up, so you've
answered it better than I could have asked it. The v2 approach of treating
the whole thing as one bug class looks like the right call to me.
Regards
Thom
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | r314tive | 2026-05-28 11:21:32 | [RFC PATCH v3] Add EXPLAIN ANALYZE wait event reporting |
| Previous Message | Vlad Lesin | 2026-05-28 10:22:30 | Re: [PATCH] Fix ProcKill lock-group vs procLatch recycle race |