Re: PG 18 release notes draft committed - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: PG 18 release notes draft committed
Date
Msg-id aBZKsM8CKxyKiI7_@momjian.us
Whole thread Raw
In response to Re: PG 18 release notes draft committed  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
On Sat, May  3, 2025 at 11:04:45PM +0800, jian he wrote:
> On Fri, May 2, 2025 at 10:44 AM Bruce Momjian <bruce@momjian.us> wrote:
> >
> > I have committd the first draft of the PG 18 release notes.  The item
> > count looks strong:
> >         release-17:   182
> >         release-18:   209
> >
> > I will continue improving it until beta 1, and until the final release.
> > I will probably add markup in 1-3 weeks.  Let the feedback begin.  ;-)
> >
> > You can see the most current HTML-built version here:
> >
> >         https://momjian.us/pgsql_docs/release-18.html
> >
> 
> seems you missed this ([1]):
> 
> Detect redundant GROUP BY columns using UNIQUE indexes
> 
> d4c3a156c added support that when the GROUP BY contained all of the columns
> belonging to a relation's PRIMARY KEY, all other columns belonging to that
> relation would be removed from the GROUP BY clause. That's possible because all
> other columns are functionally dependent on the PRIMARY KEY and those columns
> alone ensure the groups are distinct.
> 
> [1] https://git.postgresql.org/cgit/postgresql.git/commit/?id=bd10ec529796a13670645e6acd640c6f290df020

We added this item to the PG 9.6 release notes:

    <!--
    2016-02-11 [d4c3a156c] Remove GROUP BY columns that are functionally dependent
    -->
           <para>
            Ignore <literal>GROUP BY</> columns that are
            functionally dependent on other columns (David Rowley)
           </para>
    
           <para>
            If a <literal>GROUP BY</> clause includes all columns of a
            non-deferred primary key, as well as other columns of the same
            table, those other columns are redundant and can be dropped
            from the grouping.  This saves computation in many common cases.
           </para>
          </listitem>

Interestingly, the first paragraph suggests this optimization already
works for unique indexes, but the text below it states it only works for
primary keys.

As a nod to PG 9.6, which was released in 2016, I duplicated that item
and reworded it for this commit.  :-)  Patch attached.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Do not let urgent matters crowd out time for investment in the future.

Attachment

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: PG 18 release notes draft committed
Next
From: Tom Lane
Date:
Subject: Re: Fix slot synchronization with two_phase decoding enabled