mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
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
This commit is contained in:
@@ -31,16 +31,6 @@
|
||||
#define rt_fetch(rangetable_index, rangetable) \
|
||||
((RangeTblEntry *) list_nth(rangetable, (rangetable_index)-1))
|
||||
|
||||
/*
|
||||
* getrelid
|
||||
*
|
||||
* Given the range index of a relation, return the corresponding
|
||||
* relation OID. Note that InvalidOid will be returned if the
|
||||
* RTE is for a non-relation-type RTE.
|
||||
*/
|
||||
#define getrelid(rangeindex,rangetable) \
|
||||
(rt_fetch(rangeindex, rangetable)->relid)
|
||||
|
||||
/*
|
||||
* Given an RTE and an attribute number, return the appropriate
|
||||
* variable name or alias for that attribute of that RTE.
|
||||
|
Reference in New Issue
Block a user