>>>>> "shirshegsm" == shirshegsm <shirshegsm(at)gmail(dot)com> writes:
shirshegsm> After some discussion on #postgresql @ Freenode (abridged
shirshegsm> version: https://paste.fedoraproject.org/393752/16805914/)
shirshegsm> it seems that the query planner has O(n^2) complexity for
shirshegsm> the number of partitions in a partitioned table.
To sum up my part of that discussion: the repeated calls to
adjust_appendrel_attrs cause an O(N^2) number of calls to palloc, as
query_tree_mutator calls range_table_mutator which does two pallocs per
RTE (one for the RTE and one for the listcell).
Also none of those get freed, as far as I can tell, so the memory usage
is O(N^2) too.
--
Andrew (irc:RhodiumToad)