Re: RFC: extensible planner state

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-08-20T19:13:51Z
Lists: pgsql-hackers

Attachments

On Tue, Aug 19, 2025 at 2:28 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> You'll presumably have to use GetMemoryChunkContext() for RelOptInfo,
> so I don't see much downside from using it in one or even both of the
> other cases too.

Pointer dereference must be faster than a function call.

> Hm.  We don't have read support for these structs, so maybe it's fine.
> It looks weird though.

Left this one as-is for now.

Here's v2. 0001 is what you saw before with an attempt to fix the
memory context handling. 0002 removes join_search_private. All I've
tested is that the tests pass.

-- 
Robert Haas
EDB: http://www.enterprisedb.com

Commits

  1. Add extension_state member to PlannedStmt.

  2. Add planner_setup_hook and planner_shutdown_hook.

  3. Add ExplainState argument to pg_plan_query() and planner().

  4. Remove PlannerInfo's join_search_private method.

  5. Allow private state in certain planner data structures.

  6. Fix array allocation bugs in SetExplainExtensionState.

  7. Make it possible for loadable modules to add EXPLAIN options.