On Thu, Jul 18, 2019 at 2:55 AM Etsuro Fujita <etsuro.fuj...@gmail.com> wrote: > I.e., partition_bounds_merge() is performed for each pair of input > partitioned relations for a join relation in try_partitionwise_join(). > Since partition_bounds_merge() would need a lot of CPU cycles, I don't > think this is acceptable; ISTM that some redesign is needed to avoid > this. I'm wondering that once we successfully merged partition bounds > from a pair of input partitioned relations for the join relation, by > using the merged partition bounds, we could get the lists of matching > to-be-joined partitions for subsequent pairs of input partitioned > relations for the join relation in a more efficient way than by > performing partition_bounds_merge() as proposed in the patch.
I don't know whether partition_bounds_merge() is well-implemented; I haven't looked. But in general I don't see an alternative to doing some kind of merging on each pair of input relations. That's just how planning works, and I don't see why it should need to be prohibitively expensive. I might be missing something, though; do you have an idea? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company