-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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: optimize performance of IndexUsage
utilities
#53195
planner: optimize performance of IndexUsage
utilities
#53195
Conversation
Skipping CI for Draft Pull Request. |
Skipping CI for Draft Pull Request. |
8940205
to
8b925b9
Compare
IndexUsage
utilitiesIndexUsage
utilities
8b925b9
to
2c43f8b
Compare
Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
2c43f8b
to
01c0eb3
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #53195 +/- ##
================================================
+ Coverage 72.4647% 74.4752% +2.0105%
================================================
Files 1492 1492
Lines 429133 431318 +2185
================================================
+ Hits 310970 321225 +10255
+ Misses 98950 90176 -8774
- Partials 19213 19917 +704
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest |
[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 |
[LGTM Timeline notifier]Timeline:
|
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
What problem does this PR solve?
Issue Number: close #51898
Problem Summary:
This PR is trying to optimize the performance of
IndexUsage
utilities. Previously it costed around 1% CPU and did a lot of allocation. This PR tries to optimize it and get some tiny performance boost.What changed and how does it work?
indexUsage
and the internal entries.getTblInfoForUsedStatsByPhysicalID
, which is very slow because it iterates over all tables.Check List
Tests
I used https://gist.github.com/YangKeao/c02ada99d2602d5e7fb5fb94f0581015 to run a stabler
select_random_points
benchmark. It gives QPS 59029 and 58393 for the commit before index usage and with index usage enabled.After patching the index usage commit with this PR, the average QPS goes to 58854. I'm not sure whether there are other spaces to improve the performance (like improving the speed of loading stats).
As a reference: the flamegraph before this PR:
The flamegraph after this PR:
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.