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

planner: support to prune column for simple table's DELETE | tidb-test=pr/2392 #56077

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

winoros
Copy link
Member

@winoros winoros commented Sep 13, 2024

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

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Support column pruning for tables that are non-partitioned and don't have foreign keys in the DELETE statement, improving performance and saving network costs
支持对 DELETE 语句中没有外键的非分区表进行列裁剪,提升执行效率以及减少网络带宽

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Sep 13, 2024
@winoros
Copy link
Member Author

winoros commented Sep 13, 2024

/hold to control the approve status.

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 13, 2024
Copy link

codecov bot commented Sep 13, 2024

Codecov Report

Attention: Patch coverage is 92.39130% with 14 lines in your changes missing coverage. Please review.

Project coverage is 55.9663%. Comparing base (d99d445) to head (ceaa54e).

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     
Flag Coverage Δ
integration 37.1865% <91.8478%> (?)
unit 72.0296% <92.3913%> (-0.0375%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 52.9089% <ø> (+7.1170%) ⬆️

if err != nil {
return nil
}
_, err = pruneAndBuildSingleTableColPosInfoForDelete(pointPlan.OutputNames(), idxs, deletableCols, tbl, &colPosInfo, 0, nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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.
Copy link
Contributor

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))
Copy link
Contributor

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"
Copy link
Contributor

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.

@hawkingrei
Copy link
Member

/test all

@hawkingrei
Copy link
Member

/retest

1 similar comment
@hawkingrei
Copy link
Member

/retest

Copy link

ti-chi-bot bot commented Sep 18, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-18 01:08:23.151714451 +0000 UTC m=+1009772.892138391: ☑️ agreed by AilinKid.

Copy link

ti-chi-bot bot commented Sep 18, 2024

@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.

@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 18, 2024
Copy link

ti-chi-bot bot commented Sep 18, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: AilinKid
Once this PR has been reviewed and has the lgtm label, please assign gmhdbjd for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the approved label Sep 18, 2024
@winoros winoros changed the title planner: support to prune column for simple table's DELETE planner: support to prune column for simple table's DELETE | tidb-test=pr/2392 Sep 18, 2024
Copy link

tiprow bot commented Sep 19, 2024

@winoros: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
fast_test_tiprow ceaa54e link true /test fast_test_tiprow

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-1-more-lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants