pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Haowu Ge <gehaowu@bitmoe.com>
To: Richard Guo <guofenglinux@gmail.com>
Cc: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: GROUP BY ROLLUP queries on views trigger full table scans (index usage not optimized)
Date: Wed, 24 Dec 2025 18:05:35 +0800
Message-ID: <0f894411-0d2c-4455-8403-f342642e49bc@bitmoe.com> (raw)
In-Reply-To: <CAMbWs4911OFJSybB73rkxfV5L7H+XB1YG-vnAhN1wdQE=4-jYQ@mail.gmail.com>
References: <62af586c-c270-44f3-9c5e-02c81d537e3d.gehaowu@bitmoe.com>
	<CAMbWs48=zSwZEbqX4-A1jtJqWuPxu8xbkQbu+CdtHg5anM9RVg@mail.gmail.com>
	<CAMbWs48J51_SJ5nyA5P=d0mtkwvXf3rS=nOC7HL5+hjrbPZuSw@mail.gmail.com>
	<bc40b611-960b-4a98-a0ea-becd72d558d9.gehaowu@bitmoe.com>
	<CAMbWs49fQuPPMTmFL3NrshGBYoTQL26tWtg-3pA2jkmW=C5GQg@mail.gmail.com>
	<CAMbWs4-jteRUuZ63p3yyHG6=ggV9a3cNj_vMuYBrURhyXdMg_w@mail.gmail.com>
	<7543464e-d2c6-4778-add0-31a6d60e58ce.gehaowu@bitmoe.com>
	<CAMbWs48j6BvDq9aCOM_gjgM6katSyrzpdgwoBBK1F7uD8pds4w@mail.gmail.com>
	<eef00885-2b2a-4af2-b0b1-3ba04e93efe5.gehaowu@bitmoe.com>
	<CAMbWs4-99AsnnvfTuGj9C_QHXB9aNhjNyhfxXEcOWeAeq=Og5A@mail.gmail.com>
	<9e659ce0-da20-42ed-ada2-5f585a89677e.gehaowu@bitmoe.com>
	<CAMbWs4-WSvpyB=vUNjj9it+_9Qs14=cj68Vj+zQug9XR77UTQw@mail.gmail.com>
	<CAMbWs4911OFJSybB73rkxfV5L7H+XB1YG-vnAhN1wdQE=4-jYQ@mail.gmail.com>

On 12/24/25 15:50, Richard Guo wrote:
> On Thu, Dec 18, 2025 at 5:56 PM Richard Guo <guofenglinux@gmail.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

Tested and passed in both example and production environments. Thank you 
for your work.

-- 
Thanks & Best Regards
👨‍💻 Haowu Ge (葛豪武) | 🌐 www.gehaowu.com | 📡 BG5FRG | 🔐 0xDF09D8A8



Attachments:

  [application/pgp-signature] OpenPGP_signature.asc (235B, ../0f894411-0d2c-4455-8403-f342642e49bc@bitmoe.com/2-OpenPGP_signature.asc)
  download

view thread (16+ messages)  latest in thread

Message-ID: <0f894411-0d2c-4455-8403-f342642e49bc@bitmoe.com>
Permalink:  ../0f894411-0d2c-4455-8403-f342642e49bc@bitmoe.com/
Also on:    postgresql.org/message-id/0f894411-0d2c-4455-8403-f342642e49bc@bitmoe.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: gehaowu@bitmoe.com, guofenglinux@gmail.com, pgsql-bugs@lists.postgresql.org, tgl@sss.pgh.pa.us
  Subject: Re: GROUP BY ROLLUP queries on views trigger full table scans (index usage not optimized)
  In-Reply-To: <0f894411-0d2c-4455-8403-f342642e49bc@bitmoe.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox