Re: Partition-wise join for join between (declaratively) partitioned tables
Robert Haas <robertmhaas@gmail.com>
On Fri, Mar 17, 2017 at 8:10 PM, Robert Haas <robertmhaas@gmail.com> wrote: > While I was studying what you did with reparameterize_path_by_child(), > I started to wonder whether reparameterize_path() doesn't need to > start handling join paths. I think it only handles scan paths right > now because that's the only thing that can appear under an appendrel > created by inheritance expansion, but you're changing that. Maybe > it's not critical -- I think the worst consequences of missing some > handling there is that we won't consider a parameterized path in some > case where it would be advantageous to do so. Still, you might want > to investigate a bit. I spent a fair amount of time this weekend musing over reparameterize_path_by_child(). I think a key question for this patch - as you already pointed out - is whether we're happy with that approach. When we discover that we want to perform a partitionwise parameterized nestloop, and therefore that we need the paths for each inner appendrel to get their input values from the corresponding outer appendrel members rather than from the outer parent, we've got two choices. The first is to do what the patch actually does, which is to build a new path tree for the nestloop inner path parameterized by the appropriate childrel. The second is to use the existing paths, which are parameterized by the parent rel, and then somehow allow make that work. For example, you can imagine that create_plan_recurse() could pass down a list of parameterized nestloops above the current point in the path tree, and a parent-child mapping for each, and then we could try to substitute everything while actually generating the plan instead of creating paths sooner. Which is better? It would be nice to hear opinions from anyone else who cares, but after some thought I think the approach you've picked is probably better, because it's more like what we do already. We have existing precedent for reparameterizing a path, but none for allowing a Var for one relation (the parent) to in effect refer to another relation (the child). That having been said, having try_nestloop_path() perform the reparameterization at the very top of the function seems quite undesirable. You're creating a new path there before you know whether it's going to be rejected by the invalid-parameterization test and also before you know whether initial_cost_nestloop is going to reject it. It would be much better if you could find a way to postpone the reparameterization until after those steps, and only do it if you're going to try add_path(). -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Basic partition-wise join functionality.
- f49842d1ee31 11.0 landed
-
Assorted preparatory refactoring for partition-wise join.
- e139f1953f29 11.0 landed
-
Teach adjust_appendrel_attrs(_multilevel) to do multiple translations.
- 480f1f4329f1 11.0 landed
-
Stamp 10beta2.
- 42171e2cd23c 10.0 cited
-
Eat XIDs more efficiently in recovery TAP test.
- 08aed6604de2 10.0 cited
-
Abstract logic to allow for multiple kinds of child rels.
- 7a39b5e4d112 10.0 landed
-
Implement SortSupport for macaddr data type
- f90d23d0c518 10.0 cited
-
Attempt to stabilize grouping sets regression test plans.
- de4da168d57d 10.0 cited
-
Teach xlogreader to follow timeline switches
- 1148e22a82ed 10.0 cited
-
Don't scan partitioned tables.
- d3cc37f1d801 10.0 cited
-
Fix grammar.
- b4ff8609dbad 10.0 cited
-
postgres_fdw: Push down FULL JOINs with restriction clauses.
- b30fb56b07a8 10.0 cited
-
Some preliminary refactoring towards partitionwise join.
- c44c47a773bd 10.0 landed
-
contrib/amcheck needs RecentGlobalXmin to be PGDLLIMPORT'ified.
- 56018bf26eec 10.0 cited
-
Print test parameters like "foo: 123", and results like "foo = 123".
- 2a7f4f76434d 10.0 cited