Use get_call_result_type() more widely

Поиск
Список
Период
Сортировка
От Bharath Rupireddy
Тема Use get_call_result_type() more widely
Дата
Msg-id CALj2ACV23HW5HP5hFjd89FNS-z5X8r2jNXdMXcpN2BgTtKd87w@mail.gmail.com
обсуждение исходный текст
Ответы Re: Use get_call_result_type() more widely  (Michael Paquier <michael@paquier.xyz>)
Re: Use get_call_result_type() more widely  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

A review comment in another thread [1] by Michael Paquier about the
usage of get_call_result_type() instead of explicit building of
TupleDesc made me think about using it more widely. Actually, the
get_call_result_type() looks at the function definitions to figure the
column names and build the required TupleDesc, usage of which avoids
duplication of the column names between pg_proc.dat/function
definitions and source code. Also, it saves a good number of LOC ~415
[2] and the size of all the object files put together gets reduced by
~4MB, which means, the postgres binary becomes leaner by ~4MB [3]. I'm
attaching a patch for these changes.

While on this, I observed that BlessTupleDesc() is called in many
(~12) places right after get_call_result_type() which actually does
the job of BlessTupleDesc() before returning the TupleDesc. I think we
can get rid of BlessTupleDesc() after get_call_result_type(). I'm
attaching a patch for these changes too.

cirrus-ci members are happy with these patches, please see here
https://github.com/BRupireddy/postgres/tree/use_get_call_result_type()_more_widely_v1.

Thoughts?

[1] https://www.postgresql.org/message-id/Y41De5NnF2sxmJPI%40paquier.xyz

[2] 21 files changed, 97 insertions(+), 514 deletions(-)

[3] Source code is built with CFLAGS = -O3.
PATCHED:
   text    data     bss     dec     hex filename
   1043       0       0    1043     413 contrib/old_snapshot/time_mapping.o
   7192       0       0    7192    1c18 contrib/pg_visibility/pg_visibility.o
   7144       0     120    7264    1c60 src/backend/access/transam/commit_ts.o
  19681      24     248   19953    4df1 src/backend/access/transam/multixact.o
  20595       0      88   20683    50cb src/backend/access/transam/twophase.o
   6162       0      24    6186    182a src/backend/access/transam/xlogfuncs.o
  45540    2736       8   48284    bc9c src/backend/catalog/objectaddress.o
   9943       0       0    9943    26d7 src/backend/catalog/pg_publication.o
  18239       0      16   18255    474f src/backend/commands/sequence.o
   6429       0       0    6429    191d src/backend/tsearch/wparser.o
  47049    1840      52   48941    bf2d src/backend/utils/adt/acl.o
  43066     168     784   44018    abf2 src/backend/utils/adt/datetime.o
   6843       0       0    6843    1abb src/backend/utils/adt/genfile.o
   6904     120       0    7024    1b70 src/backend/utils/adt/lockfuncs.o
  10512    7008       0   17520    4470 src/backend/utils/adt/misc.o
   1569       0       0    1569     621 src/backend/utils/adt/partitionfuncs.o
  16266       0       0   16266    3f8a src/backend/utils/adt/pgstatfuncs.o
  40985       0       0   40985    a019 src/backend/utils/adt/tsvector_op.o
   8322       0       0    8322    2082 src/backend/utils/misc/guc_funcs.o
   2109       0       0    2109     83d src/backend/utils/misc/pg_controldata.o
   2354       0       0    2354     932
src/test/modules/test_predtest/test_predtest.o
  9586047  226936  205536 10018519 98ded7 src/backend/postgres

HEAD:
   text    data     bss     dec     hex filename
   1019       0       0    1019     3fb contrib/old_snapshot/time_mapping.o
   7159       0       0    7159    1bf7 contrib/pg_visibility/pg_visibility.o
   6655       0     120    6775    1a77 src/backend/access/transam/commit_ts.o
  19636      24     248   19908    4dc4 src/backend/access/transam/multixact.o
  20663       0      88   20751    510f src/backend/access/transam/twophase.o
   6206       0      24    6230    1856 src/backend/access/transam/xlogfuncs.o
  45700    2736       8   48444    bd3c src/backend/catalog/objectaddress.o
   9952       0       0    9952    26e0 src/backend/catalog/pg_publication.o
  18487       0      16   18503    4847 src/backend/commands/sequence.o
   6143       0       0    6143    17ff src/backend/tsearch/wparser.o
  47123    1840      52   49015    bf77 src/backend/utils/adt/acl.o
  43099     168     784   44051    ac13 src/backend/utils/adt/datetime.o
   7016       0       0    7016    1b68 src/backend/utils/adt/genfile.o
   7413     120       0    7533    1d6d src/backend/utils/adt/lockfuncs.o
  10698    7008       0   17706    452a src/backend/utils/adt/misc.o
   1593       0       0    1593     639 src/backend/utils/adt/partitionfuncs.o
  17194       0       0   17194    432a src/backend/utils/adt/pgstatfuncs.o
  40798       0       0   40798    9f5e src/backend/utils/adt/tsvector_op.o
   8871       0       0    8871    22a7 src/backend/utils/misc/guc_funcs.o
   3918       0       0    3918     f4e src/backend/utils/misc/pg_controldata.o
   2636       0       0    2636     a4c
src/test/modules/test_predtest/test_predtest.o
  9589943  226936  205536 10022415 98ee0f src/backend/postgres

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: Add sub-transaction overflow status in pg_stat_activity
Следующее
От: David Rowley
Дата:
Сообщение: Re: Add proper planner support for ORDER BY / DISTINCT aggregates