citusdata / citusdata/citus

Multi-row INSERTs cannot be pruned in the planner

Open
#1,623 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.