| From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
|---|---|
| To: | Haowu Ge <gehaowu(at)bitmoe(dot)com> |
| Cc: | pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Subject: | Re: GROUP BY ROLLUP queries on views trigger full table scans (index usage not optimized) |
| Date: | 2025-12-28 04:20:58 |
| Message-ID: | CAMbWs49h5F66KZwLxaeXoLwHe_9jAB7Eu44UmJhhQpLA38tKhw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
I've been back and forth on whether to back-patch these two patches to
v18, given that they can lead to plan changes.
To recap: in v18, we fixed a correctness issue regarding grouping sets
by wrapping Var expressions in PHVs. While necessary, it had the side
effect of making these expressions opaque to the planner: the planner
can no longer match these expressions to indexes or look up their
statistics. As reported here, this causes a severe performance
regression in v18 compared to previous versions.
The proposed fix is to teach the planner to look through these PHVs
when matching indexes or looking up statistics. While this fixes the
regression, it can lead to plan changes, which we want to avoid in
back branches.
However, I'm still inclined to back-patch this to v18 (and no
further), because:
1. The fix only affects queries involving PHVs in indexable or
statistical contexts. The regression tests show that only one
existing query is affected, and in a positive way. So the impact is
pretty scoped.
2. For the affected queries, the current behavior is arguably broken:
the planner is forced to ignore valid indexes and fall back to default
selectivity estimates. I think the fix is an improvement.
3. If we do not back-patch, this severe performance regression will
remain in v18 forever.
Having said that, back-patching a change that affects query plans
still keeps me up at night. Any thoughts?
- Richard
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Kapila | 2025-12-28 06:48:19 | Re: BUG #19360: Bug Report: Logical Replication initial sync fails with "conflict=update_origin_differs" PG12 toPG18 |
| Previous Message | Tom Lane | 2025-12-27 21:33:19 | Re: BUG #19363: PostgreSQL shared memory exhaustion during query execution involving views and parallel workers |