Skip to content

Planner: Run full partition pruning if convertToPointGet converted keys to SortKey (#59918) #60162

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

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #59918

What problem does this PR solve?

Issue Number: close #59827

Problem Summary:
When PointGetPlan is created by convertToPointGet, the IndexValues comes from the Range optimizer, and if any of the LIST/RANGE COLUMNS has a non-binary collation, they conditions values are converted to SortKey, which does not work with the LIST/RANGE COLUMNS partitioning pruning code, since they will unconditionally convert it again to SortKey, which may fail finding a matching partition.

NOTE: This only affects PointGet, since BatchPointGet is not supported yet.

What changed and how does it work?

If the IndexValues are already converted, run the normal partition pruning code on the conditions, to find the matching partition.

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.

Partition Pruning could fail and choose 'TableDual', i.e. no matching partition, in case the optimizer could convert the query to PointGet (if not using the FastPlan) and any LIST COLUMNS or RANGE COLUMNS had non-binary collation.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Mar 19, 2025
@ti-chi-bot ti-chi-bot bot added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Mar 19, 2025
Copy link

codecov bot commented Apr 9, 2025

Codecov Report

Attention: Patch coverage is 69.72477% with 33 lines in your changes missing coverage. Please review.

Please upload report for BASE (release-8.5@318fb14). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-8.5     #60162   +/-   ##
================================================
  Coverage               ?   56.9221%           
================================================
  Files                  ?       1769           
  Lines                  ?     628031           
  Branches               ?          0           
================================================
  Hits                   ?     357489           
  Misses                 ?     246420           
  Partials               ?      24122           
Flag Coverage Δ
integration 36.7844% <30.2752%> (?)
unit 72.5948% <68.8073%> (?)

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

Components Coverage Δ
dumpling 52.8711% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 52.2715% <0.0000%> (?)
🚀 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.

@mjonss mjonss requested review from Defined2014 and mjonss April 9, 2025 22:41
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Apr 9, 2025
@mjonss mjonss requested a review from qw4990 April 10, 2025 21:58
Copy link

ti-chi-bot bot commented Apr 14, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mjonss, 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 ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 14, 2025
Copy link

ti-chi-bot bot commented Apr 14, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-04-09 22:42:36.636069119 +0000 UTC m=+2296250.320305218: ☑️ agreed by mjonss.
  • 2025-04-14 16:56:49.132543429 +0000 UTC m=+2707502.816779510: ☑️ agreed by qw4990.

@ti-chi-bot ti-chi-bot bot merged commit 5902fb6 into pingcap:release-8.5 Apr 14, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants