Re: Partition-wise join for join between (declaratively) partitioned tables
Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
On Mon, Sep 11, 2017 at 2:16 PM, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> wrote: > On 2017/09/11 16:23, Ashutosh Bapat wrote: >> On Sat, Sep 9, 2017 at 6:28 AM, Robert Haas <robertmhaas@gmail.com> wrote: >>> I'm a bit suspicious about the fact that there are now executor >>> changes related to the PlanRowMarks. If the rowmark's prti is now the >>> intermediate parent's RT index rather than the top-parent's RT index, >>> it'd seem like that'd matter somehow. Maybe it doesn't, because the >>> code that cares about prti seems to only care about whether it's >>> different from rti. But if that's true everywhere, then why even >>> change this? I think we might be well off not to tinker with things >>> that don't need to be changed. >> >> In the definition of ExecRowMark, I see >> Index prti; /* parent range table index, if child */ >> It just says parent, by which I take as direct parent. For >> inheritance, which earlier flattened inheritance hierarchy, direct >> parent was top parent. So, probably nobody thought whether a parent is >> direct parent or top parent. But now that we have introduced that >> concept we need to interpret this comment anew. And I think >> interpreting it as direct parent is non-lossy. > > But then we also don't have anything to say about why we're making that > change. If you could describe what non-lossy is in this context, then > fine. By setting prti to the topmost parent RTI we are loosing information that this child may be an intermediate child similar to what we did earlier to AppendRelInfo. That's the lossy-ness in this context. > But that we'd like to match with what we're going to do for > AppendRelInfos does not seem to be a sufficient explanation for this change. The purpose of this patch is to change the parent-child linkages for partitioned table and prti is one of them. So, in fact, I am wondering why not to change that along with AppendRelInfo. > >> If we set top parent's >> index, parent RTI in AppendRelInfo and PlanRowMark would not agree. >> So, it looks quite natural that we set the direct parent's index in >> PlanRowMark. > > They would not agree, yes, but aren't they unrelated? If we have a reason > for them to agree, (for example, row-locking breaks in the inherited table > case if we didn't), then we should definitely make them agree. > > Updating the comment for prti definition might be something that this > patch could (should?) do, but I'm not quite sure about that too. > To me that looks backwards again for the reasons described above. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company
Commits
-
Add test for partitionwise join involving default partition.
- 4513d3a4be0b 12.0 landed
-
Rewrite the code that applies scan/join targets to paths.
- 11cf92f6e2e1 11.0 cited
-
Fix code related to partitioning schemes for dropped columns.
- cf7ab13bfb45 11.0 landed
-
Copy information from the relcache instead of pointing to it.
- 45866c75507f 11.0 landed
-
Basic partition-wise join functionality.
- f49842d1ee31 11.0 landed
-
Associate partitioning information with each RelOptInfo.
- 9140cf8269b0 11.0 landed
-
Expand partitioned table RTEs level by level, without flattening.
- 0a480502b092 11.0 landed
-
Set partitioned_rels appropriately when UNION ALL is used.
- 448aa36e8b96 10.0 landed
- 1555566d9ee1 11.0 landed
-
Remove dedicated B-tree root-split record types.
- 0c504a80cf2e 11.0 cited
-
Assorted preparatory refactoring for partition-wise join.
- e139f1953f29 11.0 cited
-
Teach adjust_appendrel_attrs(_multilevel) to do multiple translations.
- 480f1f4329f1 11.0 cited
-
Avoid unnecessary single-child Append nodes.
- d57929afc706 11.0 cited
-
Revisit handling of UNION ALL subqueries with non-Var output columns.
- dd4134ea56cb 9.2.0 cited