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

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: Haowu Ge <gehaowu@bitmoe.com>
Cc: pgsql-bugs <pgsql-bugs@lists.postgresql.org>, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2025-12-09T06:38:09Z
Lists: pgsql-bugs

Attachments

On Mon, Dec 8, 2025 at 3:10 PM Richard Guo <guofenglinux@gmail.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