In the executor, use an array of pointers to access the rangetable.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: d73f4c74dd34b19c19839f7ae09fb96442728509
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2018-10-04T19:48:17Z
Releases: 12.0
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

Files

Discussion