Skip to content

Conversation

@terry1purcell
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

What changed and how does it work?

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-linked-issue release-note-none Denotes a PR that doesn't merit a release note. labels Feb 3, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 3, 2026

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456.

📖 For more info, you can check the "Contribute Code" section in the development guide.

@ti-chi-bot ti-chi-bot bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. sig/planner SIG: Planner labels Feb 3, 2026
@pantheon-ai
Copy link

pantheon-ai bot commented Feb 3, 2026

P2: Enforced-sort enumeration keeps finite ExpectedCnt causing under-costing of blocking sorts

  • When exploring enforced-sort plans, the optimizer clears SortItems but keeps the original small ExpectedCnt derived from LIMIT.
  • This costs child plans as if they can early-stop, but PhysicalSort is blocking and must consume the full input.
  • Leads to under-estimated costs for both scan work and the sort operation itself.
  • Evidence: pkg/planner/core/find_best_task.go:665 has //newProp.ExpectedCnt = math.MaxFloat64 commented out.
  • Fix: Restore newProp.ExpectedCnt = math.MaxFloat64 when entering enforced-sort enumeration.

P2: Join stats skewing under enforced sort

  • Join enumeration scales stats and child row requirements using prop.ExpectedCnt even when a blocking sort enforcer will be added above.
  • The enforced PhysicalSort must consume the full join output, making the early-stop assumption invalid.
  • Evidence: pkg/planner/core/exhaust_physical_plans.go:208 uses ScaleByExpectCnt(..., prop.ExpectedCnt) for join planning.
  • Fix: Keep ExpectedCnt = math.MaxFloat64 when the parent will enforce order above the subtree.

P2: Paging incorrectly enabled on PhysicalIndexLookUpReader under enforced sort

  • When ExpectedCnt is small, paging is enabled on PhysicalIndexLookUpReader even when an enforced sort above will read all rows.
  • This changes runtime behavior (more KV requests) and biases cost modeling.
  • Evidence: pkg/planner/core/plan_cost_ver2.go:410 enables paging based on ExpectedCnt that may represent a LIMIT above an enforced sort.
  • Fix: Do not let finite ExpectedCnt reach PhysicalIndexLookUpReader in the enforced-sort branch.

P2: Commented-out code in core planner path

  • The line //newProp.ExpectedCnt = math.MaxFloat64 at pkg/planner/core/find_best_task.go:665 is left without explanation.
  • This violates coding standards and obscures intended behavior in a hot optimizer path.
  • Evidence: Commented-out functional code in findBestTask without rationale.
  • Fix: Remove the commented line or replace it with an explanatory comment.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 3, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign winoros for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Details 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

@tiprow
Copy link

tiprow bot commented Feb 3, 2026

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.

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 kubernetes-sigs/prow repository.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 3, 2026

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

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/check_dev_2 612c0c6 link true /test check-dev2
idc-jenkins-ci-tidb/check_dev 612c0c6 link true /test check-dev
idc-jenkins-ci-tidb/unit-test 612c0c6 link true /test unit-test
pull-unit-test-next-gen 612c0c6 link true /test pull-unit-test-next-gen

Full PR test history. Your PR dashboard.

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 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/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant