Skip to content

Conversation

@VGalaxies
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #60604

Problem Summary: see #60604

What changed and how does it work?

The fast plan check is now performed at the very beginning of observeStmtBeginForTopSQL. This change skips the expensive GetPlanDigest call when TopSQL is disabled and the execution plan is a fast path, since point gets return early and the plan digest is only cached without further use.

For this optimization to take effect, TopSQL, slow log, and statement summary must be disabled.

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.

before:

image

after (no GetPlanDigest found in flame graph):

image

in our special edition of TiDB, sysbench point select QPS can have 2~3% increment

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 the release-note-none Denotes a PR that doesn't merit a release note. label Apr 16, 2025
@sre-bot
Copy link
Contributor

sre-bot commented Apr 16, 2025

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Apr 16, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Apr 16, 2025

Welcome @VGalaxies!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. 😃

@ti-chi-bot
Copy link

ti-chi-bot bot commented Apr 16, 2025

Hi @VGalaxies. 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.

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.

@tiprow
Copy link

tiprow bot commented Apr 16, 2025

Hi @VGalaxies. 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.

@lance6716 lance6716 requested review from Copilot and crazycs520 April 16, 2025 09:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

pkg/executor/adapter.go:2162

  • Ensure that the early return when a fast plan is detected does not bypass any essential logging or metric updates that might be needed for diagnostic purposes in production.
if (!topsqlstate.TopSQLEnabled() && IsFastPlan(a.Plan)) {

@lance6716
Copy link
Contributor

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Apr 16, 2025
@lance6716 lance6716 added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Apr 16, 2025
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 16, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Apr 16, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: crazycs520, lance6716

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [crazycs520,lance6716]

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 Apr 16, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Apr 16, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-04-16 09:33:23.677195707 +0000 UTC m=+2853697.361431803: ☑️ agreed by lance6716.
  • 2025-04-16 09:38:22.726907491 +0000 UTC m=+2853996.411143587: ☑️ agreed by crazycs520.

@codecov
Copy link

codecov bot commented Apr 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.4986%. Comparing base (4f2d944) to head (8146832).
Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #60605        +/-   ##
================================================
+ Coverage   73.0969%   73.4986%   +0.4017%     
================================================
  Files          1715       1715                
  Lines        475094     475135        +41     
================================================
+ Hits         347279     349218      +1939     
+ Misses       106453     104552      -1901     
- Partials      21362      21365         +3     
Flag Coverage Δ
integration 42.8213% <100.0000%> (?)
unit 72.3140% <100.0000%> (-0.0139%) ⬇️

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

Components Coverage Δ
dumpling 52.6553% <ø> (ø)
parser ∅ <ø> (∅)
br 47.2688% <ø> (+0.0304%) ⬆️
🚀 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.

@ti-chi-bot ti-chi-bot bot merged commit 2c103b4 into pingcap:master Apr 16, 2025
24 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #60607.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

in point select use case, GetPlanDigest call incurs unnecessary CPU overhead when disable top sql

5 participants