-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Closed
Copy link
Labels
type/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.
Description
Enhancement
When projection push down system variable is set on, all logical projections that contain push-downable expressions will generate potential tikv side physical projections. Currently optimizer evaluates the cost of root-side projection and tikv-side projection cost here:
tidb/pkg/planner/core/plan_cost_ver2.go
Line 102 in 57d0b40
func (p *PhysicalProjection) GetPlanCostVer2(taskType property.TaskType, option *optimizetrace.PlanCostOption) (costusage.CostVer2, error) { |
Although it does consider network cost, calculation concurrency, expressions calculation overhead and other factors that may affect performance, in real situation it still have chances to chooses to push down some projections while performance degrades.
I can't give a decrete example here, but I believe we can't be too careful of such plan change logic. So we can consider adding some strict rules that only projections that satisfy these rules, can be pushed down to tikv side. Currently, I can think out two rules:
- Projections that only prune columns can be pushed down
- Projections' top expressions are json search functions or json value attributes functions(https://docs.pingcap.com/tidb/stable/json-functions).
Metadata
Metadata
Assignees
Labels
type/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.