Skip to content

Limit projection pushed down scope to avoid potential performance degression #53613

@yibin87

Description

@yibin87

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:

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:

  1. Projections that only prune columns can be pushed down
  2. Projections' top expressions are json search functions or json value attributes functions(https://docs.pingcap.com/tidb/stable/json-functions).

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementThe issue or PR belongs to an enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions