Skip to content

planner: fix LogicalProjection.DeriveStats allocate too many memories (#63829) | tidb-test=920d9bf1b1137cda1272bdd59ae527aee8067944#64006

Merged
ti-chi-bot[bot] merged 3 commits intopingcap:release-6.5-20241112-v6.5.11from
ti-chi-bot:cherry-pick-63829-to-release-6.5-20241112-v6.5.11
Oct 17, 2025
Merged

planner: fix LogicalProjection.DeriveStats allocate too many memories (#63829) | tidb-test=920d9bf1b1137cda1272bdd59ae527aee8067944#64006
ti-chi-bot[bot] merged 3 commits intopingcap:release-6.5-20241112-v6.5.11from
ti-chi-bot:cherry-pick-63829-to-release-6.5-20241112-v6.5.11

Conversation

@ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #63829

What problem does this PR solve?

Issue Number: close #63810

Problem Summary:

What changed and how does it work?

Previously, we didn't pay attention to reusing the slices of columns, which led to a lot of memory allocation here. We have specially optimized this.

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.

None

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/cherry-pick-for-release-6.5-20241112-v6.5.11 labels Oct 17, 2025
@ti-chi-bot
Copy link
Member Author

@hawkingrei This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 17, 2025

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

Details

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 17, 2025
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 17, 2025
@hawkingrei
Copy link
Member

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 17, 2025
if len(exprs) == 0 {
return nil
}
for _, expr := range exprs {
Copy link
Contributor

Choose a reason for hiding this comment

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

cols = cols[:0]

Copy link
Contributor

@AilinKid AilinKid Oct 17, 2025

Choose a reason for hiding this comment

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

how about move to here, after all, your func name says it will reuse...

Copy link
Member

Choose a reason for hiding this comment

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

Updated

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Oct 17, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 17, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, hawkingrei

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [AilinKid,hawkingrei]

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 added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 17, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 17, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-10-17 07:49:36.357096345 +0000 UTC m=+426082.434348915: ☑️ agreed by AilinKid.
  • 2025-10-17 07:49:51.583670755 +0000 UTC m=+426097.660923355: ☑️ agreed by hawkingrei.

@hawkingrei hawkingrei changed the title planner: fix LogicalProjection.DeriveStats allocate too many memories (#63829) planner: fix LogicalProjection.DeriveStats allocate too many memories (#63829) | tidb-test=pr/2620 Oct 17, 2025
@hawkingrei
Copy link
Member

/retest

@hawkingrei hawkingrei changed the title planner: fix LogicalProjection.DeriveStats allocate too many memories (#63829) | tidb-test=pr/2620 planner: fix LogicalProjection.DeriveStats allocate too many memories (#63829) | tidb-test=920d9bf1b1137cda1272bdd59ae527aee8067944 Oct 17, 2025
@hawkingrei
Copy link
Member

/retest

@codecov
Copy link

codecov bot commented Oct 17, 2025

Codecov Report

❌ Patch coverage is 88.46154% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release-6.5-20241112-v6.5.11@9611112). Learn more about missing BASE report.

Additional details and impacted files
@@                        Coverage Diff                        @@
##             release-6.5-20241112-v6.5.11     #64006   +/-   ##
=================================================================
  Coverage                                ?   73.6241%           
=================================================================
  Files                                   ?       1097           
  Lines                                   ?     352967           
  Branches                                ?          0           
=================================================================
  Hits                                    ?     259869           
  Misses                                  ?      76376           
  Partials                                ?      16722           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ti-chi-bot ti-chi-bot bot merged commit fa8e9d9 into pingcap:release-6.5-20241112-v6.5.11 Oct 17, 2025
10 checks passed
@ti-chi-bot ti-chi-bot bot deleted the cherry-pick-63829-to-release-6.5-20241112-v6.5.11 branch October 17, 2025 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-6.5-20241112-v6.5.11

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants