Multi-row INSERTs cannot be pruned in the planner
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
We currently skip pruning of multi-row `INSERT`s in the planner, which means prepared multi-row `INSERT` statements do not give much benefit.
When we plan a multi-row `INSERT`, we add the rows that go to a particular shard in the `rowValuesLists` of each `Task` and we use this `rowValuesLists` during deparsing. However, we currently don't evaluate functions in `rowValuesLists`, so expressions in non-partition columns would be incorrectly pushed down to workers if we did pruning in the planner.
One of the added complexities is that we work with a rewritten query in the planner, with constant expressions evaluated by the postgres planner, and the original query in the executor, with expressions evaluated by `ExecuteMasterEvaluableFunctions`.
Contributor guide
Assessment
This issue has not been assessed yet.