pgsql: Skip useless calculation of join RTE column names during EXPLAIN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Skip useless calculation of join RTE column names during EXPLAIN
Date: 2024-12-17 20:52:25
Message-ID: E1tNeYK-0005Ps-Nb@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Skip useless calculation of join RTE column names during EXPLAIN.

There's no need for set_simple_column_names() to compute unique
column names for join RTEs, because a finished plan tree will
not contain any join alias Vars that we could need names for.
Its other, internal callers will not pass it any join RTEs
anyway, so the upshot is we can just skip join RTEs here.

Aside from getting rid of a klugy against-its-documentation use of
set_relation_column_names, this can speed up EXPLAIN substantially
when considering many-join queries, because the upper join RTEs
tend to have a lot of columns.

Sami Imseih, with cosmetic changes by me

Discussion: https://postgr.es/m/CAA5RZ0th3q-0p1pri58z9grG8r8azmEBa8o1rtkwhLmJg_cH+g@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7a80e381d16c642d00ec6146ccdf1262a159c69e

Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Nathan Bossart 2024-12-17 21:27:25 pgsql: Accommodate very large dshash tables.
Previous Message Melanie Plageman 2024-12-17 19:21:18 pgsql: Rename LVRelState->frozen_pages