Re: Pathify RHS unique-ification for semijoin planning

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Pathify RHS unique-ification for semijoin planning
Date: 2025-08-13 03:17:00
Message-ID: CAMbWs4-DPCrCCvr4QKZmedKmBy_H-5dU3bswG28g5PPGbZP=Aw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 13, 2025 at 11:27 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Richard Guo <guofenglinux(at)gmail(dot)com> writes:
> > In this patch, the only instance that doesn't follow the "unique-ify"
> > form is the macro IS_UNIQUEIFIED_REL, as dashes are not allowed in C
> > identifiers. Maybe a better alternative is IS_RELATION_UNIQUE? Any
> > suggestions?

> Hm ... to my ear, "unique-ified" implies that we took some positive
> action to make the path's output unique, such as running it through
> a hashagg or Unique node. IS_RELATION_UNIQUE only implies that the
> output is unique, so for example a scan of a primary key should
> satisfy such a predicate. Not having read the patch (I do hope
> to get to that), I'm not sure which connotation you have in mind.
> If it's the latter, IS_RELATION_UNIQUE seems like a fine name.
> If it's the former, maybe something like "RELATION_WAS_MADE_UNIQUE"?
> That's not very pretty though ...

It's the former: this macro is to signal that we've explicitly taken
steps to make the output of the relation unique. IMO, "unique-ified"
best describes this, but we cannot use it directly in the macro name
because of the dash.

Hmm, I think "RELATION_WAS_MADE_UNIQUE" works well because it clearly
conveys that the relation has been explicitly unique-ified. It's a
bit verbose, but I found that we have similar names in our codebase,
such as VAC_BLK_WAS_EAGER_SCANNED.

Thanks
Richard

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-08-13 03:20:26 Re: Adding locks statistics
Previous Message Amit Kapila 2025-08-13 02:53:59 Re: Excessive LOG messages from replication slot sync worker