pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Guo <rguo@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Centralize collection of catalog info needed early in the planne
Date: Tue, 22 Jul 2025 02:23:08 +0000
Message-ID: <E1ue2eq-0007MK-0G@gemulon.postgresql.org> (raw)

Centralize collection of catalog info needed early in the planner

There are several pieces of catalog information that need to be
retrieved for a relation during the early stage of planning.  These
include relhassubclass, which is used to clear the inh flag if the
relation has no children, as well as a column's attgenerated and
default value, which are needed to expand virtual generated columns.
More such information may be required in the future.

Currently, these pieces of catalog data are collected in multiple
places, resulting in repeated table_open/table_close calls for each
relation in the rangetable.  This patch centralizes the collection of
all required early-stage catalog information into a single loop over
the rangetable, allowing each relation to be opened and closed only
once.

Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAMbWs4-bFJ1At4btk5wqbezdu8PLtQ3zv-aiaY3ry9Ymm=jgFQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/904f6a593a06649f77597ab9a72ef97c21e39a93

Modified Files
--------------
src/backend/optimizer/plan/planner.c      |  31 +---
src/backend/optimizer/plan/subselect.c    |   9 +-
src/backend/optimizer/prep/prepjointree.c | 299 ++++++++++++++++++------------
src/include/optimizer/prep.h              |   2 +-
4 files changed, 190 insertions(+), 151 deletions(-)



Message-ID: <E1ue2eq-0007MK-0G@gemulon.postgresql.org>
Permalink:  ../E1ue2eq-0007MK-0G@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ue2eq-0007MK-0G@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: rguo@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Centralize collection of catalog info needed early in the planne
  In-Reply-To: <E1ue2eq-0007MK-0G@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox