In the executor, use an array of pointers to access the rangetable.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 4 Oct 2018 19:48:17 +0000 (15:48 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 4 Oct 2018 19:48:17 +0000 (15:48 -0400)
commitd73f4c74dd34b19c19839f7ae09fb96442728509
treec90ec26d55c24bfca08d92cb6b43873cb64ae848
parent9ddef36278a9f676c07d0b4d9f33fa22e48ce3b5
In the executor, use an array of pointers to access the rangetable.

Instead of doing a lot of list_nth() accesses to es_range_table,
create a flattened pointer array during executor startup and index
into that to get at individual RangeTblEntrys.

This eliminates one source of O(N^2) behavior with lots of partitions.
(I'm not exactly convinced that it's the most important source, but
it's an easy one to fix.)

Amit Langote and David Rowley

Discussion: https://postgr.es/m/468c85d9-540e-66a2-1dde-fec2b741e688@lab.ntt.co.jp
contrib/postgres_fdw/postgres_fdw.c
src/backend/commands/copy.c
src/backend/commands/trigger.c
src/backend/executor/execExprInterp.c
src/backend/executor/execMain.c
src/backend/executor/execUtils.c
src/backend/executor/nodeLockRows.c
src/backend/replication/logical/worker.c
src/include/executor/executor.h
src/include/nodes/execnodes.h
src/include/parser/parsetree.h