Skip to content

Conversation

0xPoe
Copy link
Member

@0xPoe 0xPoe commented Mar 14, 2024

What problem does this PR solve?

Issue Number: close #51775

Problem Summary:

We are analyzing the same table multiple times because when an index is analyzed in TiDB, it also analyzes other indexes and columns.

What changed and how does it work?

Only one index should be analyzed. Multiple indexes are stored to track the total analyzed indexes, even if only one is triggered.

You can check the tests to see what is the correct behavior.

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

0xPoe added 2 commits March 14, 2024 17:22
Signed-off-by: hi-rustin <[email protected]>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed do-not-merge/needs-triage-completed labels Mar 14, 2024
Signed-off-by: hi-rustin <[email protected]>
Copy link
Member Author

@0xPoe 0xPoe left a comment

Choose a reason for hiding this comment

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

🔢 Self-check (PR reviewed by myself and ready for feedback.)

@@ -204,6 +204,7 @@ func (j *DynamicPartitionedTableAnalysisJob) analyzePartitionIndexes(
) {
analyzePartitionBatchSize := int(variable.AutoAnalyzePartitionBatchSize.Load())

OnlyPickOneIndex:
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 reasons I use a label here are:

  1. I can't easily retrieve the first kv from a map, so I prefer to use a for loop.
  2. If I directly return from the inner loop, I will get an SA4004 warning from the static check.

So I think a named label would help.

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Merging #51785 (041ace2) into master (47d86a7) will increase coverage by 2.1009%.
Report is 7 commits behind head on master.
The diff coverage is 73.3333%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #51785        +/-   ##
================================================
+ Coverage   70.7335%   72.8345%   +2.1009%     
================================================
  Files          1476       1476                
  Lines        437532     437758       +226     
================================================
+ Hits         309482     318839      +9357     
+ Misses       108659      98910      -9749     
- Partials      19391      20009       +618     
Flag Coverage Δ
integration 48.8766% <0.0000%> (?)
unit 70.5076% <73.3333%> (-0.0420%) ⬇️

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

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 51.4545% <ø> (+5.5523%) ⬆️

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 14, 2024
Copy link

ti-chi-bot bot commented Mar 14, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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

The pull request process is described 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 added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 14, 2024
Copy link

ti-chi-bot bot commented Mar 14, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-03-14 10:46:35.655674344 +0000 UTC m=+941622.677920727: ☑️ agreed by hawkingrei.
  • 2024-03-14 12:53:29.810164253 +0000 UTC m=+949236.832410641: ☑️ agreed by winoros.

@ti-chi-bot ti-chi-bot bot merged commit 1717648 into pingcap:master Mar 14, 2024
@0xPoe 0xPoe deleted the rustin-patch-51775 branch March 21, 2024 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved component/statistics lgtm release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no data change in the table, but auto analyze is trigged many times
3 participants