tidb icon indicating copy to clipboard operation
tidb copied to clipboard

planner: fix a estimation case when index.hist.NDV is greater than index.topN.num.

Open AilinKid opened this issue 5 months ago • 7 comments

What problem does this PR solve?

Issue Number: close https://github.com/pingcap/tidb/issues/61792

Problem Summary:

What changed and how does it work?

Check List

Tests

  • [ ] Unit test
  • [x] 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

AilinKid avatar Jun 18 '25 03:06 AilinKid

Hi @AilinKid. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

tiprow[bot] avatar Jun 18 '25 03:06 tiprow[bot]

Codecov Report

:x: Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 73.8472%. Comparing base (8310982) to head (83df8b1). :warning: Report is 585 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #61793        +/-   ##
================================================
+ Coverage   73.0493%   73.8472%   +0.7978%     
================================================
  Files          1730       1736         +6     
  Lines        481618     487972      +6354     
================================================
+ Hits         351819     360354      +8535     
+ Misses       108261     106019      -2242     
- Partials      21538      21599        +61     
Flag Coverage Δ
integration 42.6503% <70.0000%> (?)
unit 72.6877% <70.0000%> (+0.4042%) :arrow_up:

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

Components Coverage Δ
dumpling 52.7804% <ø> (ø)
parser ∅ <ø> (∅)
br 46.6145% <ø> (+0.0286%) :arrow_up:
:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jun 18 '25 04:06 codecov[bot]

@AilinKid Please remember to update the test result sets.

hawkingrei avatar Jun 18 '25 04:06 hawkingrei

/test check-dev2

AilinKid avatar Jun 18 '25 06:06 AilinKid

@AilinKid: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test check-dev2

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.

tiprow[bot] avatar Jun 18 '25 06:06 tiprow[bot]

[APPROVALNOTIFIER] This PR is APPROVED

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

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[bot] avatar Jun 20 '25 06:06 ti-chi-bot[bot]

[LGTM Timeline notifier]

Timeline:

  • 2025-06-18 04:09:04.068581476 +0000 UTC m=+244796.791760458: :ballot_box_with_check: agreed by hawkingrei.
  • 2025-06-20 06:56:49.769921258 +0000 UTC m=+427662.493100239: :ballot_box_with_check: agreed by qw4990.

ti-chi-bot[bot] avatar Jun 20 '25 06:06 ti-chi-bot[bot]

@AilinKid: 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 83df8b1e6df93eca67833565d9e989e55bd5d675 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.

tiprow[bot] avatar Jun 20 '25 06:06 tiprow[bot]

/test check-dev2

AilinKid avatar Jun 20 '25 08:06 AilinKid

@AilinKid: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test check-dev2

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.

tiprow[bot] avatar Jun 20 '25 08:06 tiprow[bot]

-1

terry1purcell avatar Jun 25 '25 16:06 terry1purcell

Added a negative 1 comment above for the following reasons:

  1. Questions were raised by two reviewers about the need for "isFullLoad" check in this PR - but neither comment was answered/resolved in this PR.
  2. If the usage of isFullLoad is correct - it implies that the accuracy of notNullCount() is of concern if the statistics are not fully loaded. However, if this IF check fails (because of !isFullLoad), then the next step in the code (after that IF) will go ahead and use notNullCount() to calculate avgRowEstimate. That line should also have the same accuracy risk. This PR therefore appears to be incomplete.

terry1purcell avatar Jun 25 '25 16:06 terry1purcell

In response to a cherrypick label: new pull request created to branch release-8.5: #63592. But this PR has conflicts, please resolve them!

ti-chi-bot avatar Sep 17 '25 21:09 ti-chi-bot