Re: Pathify RHS unique-ification for semijoin planning

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: Alexandra Wang <alexandra.wang.oss@gmail.com>
Cc: Álvaro Herrera <alvherre@kurilemu.de>, PostgreSQL-development <pgsql-hackers@postgresql.org>, Tom Lane <tgl@sss.pgh.pa.us>, Andy Fan <zhihuifan1213@163.com>, wenhui qiu <qiuwenhuifx@gmail.com>
Date: 2025-08-19T03:05:19Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Simplify relation_has_unique_index_for()

  2. Pathify RHS unique-ification for semijoin planning

  3. Convert varatt.h access macros to static inline functions.

  4. Re-export a few of createplan.c's make_xxx() functions.

On Mon, Aug 18, 2025 at 3:07 PM Richard Guo <guofenglinux@gmail.com> wrote:
> Here's the updated version of the patch, which renames the macro
> IS_UNIQUEIFIED_REL to RELATION_WAS_MADE_UNIQUE, and includes some
> comment updates as well.  I plan to push it soon, barring any
> objections.

Pushed.

> This patch removes the last call to make_sort_from_sortclauses(), so
> I'm wondering if we can safely remove the function itself.  Or should
> we keep it around in case it's used by extensions or might be needed
> in the future?

This function, along with two other make_xxx() functions from
createplan.c, was exported in 570be1f73 because CitusDB was using
them.

commit 570be1f73f385abb557bda15b718d7aac616cc15
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date:   Sat Mar 12 12:12:59 2016 -0500

    Re-export a few of createplan.c's make_xxx() functions.

    CitusDB is using these and don't wish to redesign their code right now.
    I am not on board with this being a good idea, or a good precedent,
    but I lack the energy to fight about it.

I actually agree with Tom that it's not a good idea to create Plan
nodes outside of createplan.c; instead, one should construct a Path
tree and let create_plan() convert it into Plan nodes.

I'm not sure whether CitusDB has redesigned their code in this way,
but for now, I prefer not to remove make_sort_from_sortclauses() just
to be safe.

Thanks
Richard