Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #51876
yibin87 opened this issue May 28, 2024 · 0 comments · Fixed by #53650
Closed
Tracked by #51876

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

yibin87 opened this issue May 28, 2024 · 0 comments · Fixed by #53650
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@yibin87
Copy link
Contributor

yibin87 commented May 28, 2024

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).
@yibin87 yibin87 added the type/enhancement The issue or PR belongs to an enhancement. label May 28, 2024
@yibin87 yibin87 changed the title Limit projection pushed down scope to avoid performance degression Limit projection pushed down scope to avoid potential performance degression May 28, 2024
ti-chi-bot bot pushed a commit that referenced this issue Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant