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: adjust estimated rows to account for modified rows #50970

Merged
merged 35 commits into from
Mar 13, 2024

Conversation

terry1purcell
Copy link
Contributor

@terry1purcell terry1purcell commented Feb 4, 2024

What problem does this PR solve?

Issue Number: close #47523

Problem Summary: Out of range estimation has two significant deficiencies that impact the reported issue:

  1. The NDV used is for the full index, which may be too high if predicates match a subset of the columns.
  2. The out-of-range estimation does adequately account for the fact that modifications may include inserts (or updates) that mean that the WHERE clause predicate is now in range.

What changed and how does it work?

Estimated row calculation is changed to account for modify row count and usage of the subset NDV if one exists.

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

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked release-note-none needs-ok-to-test size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 4, 2024
Copy link

ti-chi-bot bot commented Feb 4, 2024

Hi @terry1purcell. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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/test-infra repository.

Copy link

tiprow bot commented Feb 4, 2024

Hi @terry1purcell. 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/test-infra repository.

@hawkingrei
Copy link
Member

/ok-to-test

Copy link

codecov bot commented Feb 5, 2024

Codecov Report

Merging #50970 (143e3fe) into master (893104a) will increase coverage by 1.9958%.
The diff coverage is 93.0232%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #50970        +/-   ##
================================================
+ Coverage   70.7384%   72.7343%   +1.9958%     
================================================
  Files          1475       1475                
  Lines        437308     437348        +40     
================================================
+ Hits         309345     318102      +8757     
+ Misses       108598      99257      -9341     
- Partials      19365      19989       +624     
Flag Coverage Δ
integration 48.5875% <81.3953%> (?)
unit 70.5027% <93.0232%> (-0.0499%) ⬇️

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

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

@ti-chi-bot ti-chi-bot bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 6, 2024
@terry1purcell
Copy link
Contributor Author

reopen after rebase

@terry1purcell terry1purcell reopened this Feb 7, 2024
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 7, 2024
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 8, 2024
@terry1purcell
Copy link
Contributor Author

/retest

@terry1purcell
Copy link
Contributor Author

/retest

Copy link

ti-chi-bot bot commented Mar 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qw4990, time-and-fate

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:
  • OWNERS [qw4990,time-and-fate]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

ti-chi-bot bot commented Mar 13, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-03-12 07:21:25.564283734 +0000 UTC m=+756512.586530121: ☑️ agreed by time-and-fate.
  • 2024-03-13 03:38:51.967396033 +0000 UTC m=+829558.989642421: ☑️ agreed by qw4990.

@qw4990
Copy link
Contributor

qw4990 commented Mar 13, 2024

This PR is great but is the related issue number correct? #47523 seems about the display and update of modify_cnt and stats_healthy, not about cardinality estimation.

@qw4990
Copy link
Contributor

qw4990 commented Mar 13, 2024

/retest

@terry1purcell
Copy link
Contributor Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 47a990e into pingcap:master Mar 13, 2024
23 checks passed
@terry1purcell terry1purcell deleted the outofrange branch March 13, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test release-note-none 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.

Repeatedly updating the same row will cause the stats_healthy to become low and generate wrong query plan
4 participants