-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
planner: support to prune column for simple table's DELETE | tidb-test=pr/2392 #56077
base: master
Are you sure you want to change the base?
Conversation
ffc8ea4
to
cb44d68
Compare
/hold to control the approve status. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #56077 +/- ##
=================================================
- Coverage 72.9601% 55.9663% -16.9938%
=================================================
Files 1611 1736 +125
Lines 447502 625226 +177724
=================================================
+ Hits 326498 349916 +23418
- Misses 100909 251508 +150599
- Partials 20095 23802 +3707
Flags with carried forward coverage won't be shown. Click here to find out more.
|
pkg/planner/core/point_get_plan.go
Outdated
if err != nil { | ||
return nil | ||
} | ||
_, err = pruneAndBuildSingleTableColPosInfoForDelete(pointPlan.OutputNames(), idxs, deletableCols, tbl, &colPosInfo, 0, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The https://github.com/pingcap/tidb/blob/master/pkg/planner/optimize.go#L233 fast path plan building should also be considered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the delete op should finally fall into this place. I think it should be safe. I'll add some test
@@ -5266,76 +5268,143 @@ func buildColumns2HandleWithWrtiableColumns( | |||
// This function records the following things: | |||
// 1. The position of the columns used by indexes in the DELETE's select's output. | |||
// 2. The row id's position in the output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to update the comments too as the returned result is changed.
|
||
// Fix the column offsets. | ||
pruned := 0 | ||
fixedPos := make(map[int]int, len(deletableCols)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the memory be reused for visitedCols
and fixedPos
in some way? As it's a critical path for each statement.
"delete from t where a = 1", | ||
"delete from t3 where b = 1", | ||
"delete from pt2", | ||
"delete t, t3 from t, t3 where t.a = t3.a" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to cover the fast path and the batch point get path.
/test all |
/retest |
1 similar comment
/retest |
[LGTM Timeline notifier]Timeline:
|
@AilinKid: Your lgtm message is repeated, so it is ignored. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: AilinKid The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
f4467b4
to
51c80de
Compare
@winoros: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: ref #38911
Problem Summary:
What changed and how does it work?
Support pruning columns for non-partitioned, non-fk tables in the DELETE statement. (point get will not prune also).
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.