Re: A tidyup of pathkeys.c

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: A tidyup of pathkeys.c
Date: 2025-10-14 08:04:53
Message-ID: CAMbWs4-U66V9F-pz2zEngoLP=UHU4G7LMuFJh_kfdtoRrekB2g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 14, 2025 at 3:03 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> Here's a list of what I've changed:
>
> 1. Add count_common_leading_pathkeys_ordered() function to check for
> leading common pathkeys and use that for sort_pathkeys,
> window_pathkeys and window_pathkeys.
> 2. Add count_common_leading_pathkeys_unordered() to check for leading
> common pathkeys that exist in any portion of the other list of
> pathkeys. Use this for group_pathkeys and distinct_pathkeys.
> 3. Add some short-circuiting to truncate_useless_pathkeys() as there's
> no point in trying to trim down the list when some other operation has
> already figured out that it needs all of the pathkeys.
> 4. Remove the stray " if (root->group_pathkeys != NIL) return true"
> from has_useful_pathkeys().

+1. I think this is a nice tidy-up.

FWIW, I complained about the stray check in has_useful_pathkeys() in
[1] last week, but you were quicker than me in making the code change
to remove it.

[1] https://postgr.es/m/CAMbWs4_zW5QU=Zk32s17p8qWY+ga-3ZUTons+y+Wopguiopm4A@mail.gmail.com

- Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2025-10-14 08:13:05 Re: get rid of RM_HEAP2_ID
Previous Message Michael Paquier 2025-10-14 08:04:12 Re: Executing pg_createsubscriber with a non-compatible control file