Skip useless calculation of join RTE column names during EXPLAIN.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 17 Dec 2024 20:52:05 +0000 (15:52 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 17 Dec 2024 20:52:12 +0000 (15:52 -0500)
commit7a80e381d16c642d00ec6146ccdf1262a159c69e
treeb2440569e16e2657a2a92892161dcda09023fcae
parentdc6acfd910b868351f115382fd92f95e5345992c
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
src/backend/utils/adt/ruleutils.c