Re: GROUP BY ROLLUP queries on views trigger full table scans (index usage not optimized)

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-09 06:38:09
Message-ID: CAMbWs4-jteRUuZ63p3yyHG6=ggV9a3cNj_vMuYBrURhyXdMg_w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Dec 8, 2025 at 3:10 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> As a viable alternative, maybe we can use a lightweight, read-only
> expression walker on the operand tree first to detect the presence of
> any PHVs. We only trigger the expensive deep mutation if this
> preliminary check confirms that it is actually necessary.

Here is an updated patch along these lines.

Haowu, could you please verify if it fixes your query?

- Richard

Attachment Content-Type Size
v2-0001-Strip-PlaceHolderVars-from-index-operands.patch application/octet-stream 12.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Haowu Ge 2025-12-09 08:54:35 Re: GROUP BY ROLLUP queries on views trigger full table scans (index usage not optimized)
Previous Message Michael Paquier 2025-12-09 06:26:00 Re: BUG #19095: Test if function exit() is used fail when linked static