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-24 07:50:27
Message-ID: CAMbWs4911OFJSybB73rkxfV5L7H+XB1YG-vnAhN1wdQE=4-jYQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Dec 18, 2025 at 5:56 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> Upon closer look, it seems that we do not need the syntactic scope
> check at all, as long as we ensure that phnullingrels is empty. In
> this case, the PHV is either a no-op (from a reduced outer join) or
> used for identity separation (grouping sets). In either case, the PHV
> is transparent regarding the value, so it should not prevent the
> underlying expression from matching the index.

Here is the updated version along the lines of this idea.

- Richard

Attachment Content-Type Size
v4-0001-Strip-PlaceHolderVars-from-index-operands.patch application/octet-stream 12.6 KB
v4-0002-Ignore-PlaceHolderVars-when-looking-up-statistics.patch application/octet-stream 7.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Langote 2025-12-24 08:08:33 Re: BUG #19355: Attempt to insert data unexpectedly during concurrent update
Previous Message Tender Wang 2025-12-24 02:40:00 Re: BUG #19353: Error XX000 if referencing expanded array in grouping set: variable not found in subplan target list