-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: optimize query statements summary table by avoid decode plan for each row #25892
Conversation
Signed-off-by: crazycs <[email protected]>
Signed-off-by: crazycs <[email protected]>
Signed-off-by: crazycs <[email protected]>
Signed-off-by: crazycs <[email protected]>
Please follow PR Title Format:
Or if the count of mainly changed packages are more than 3, use
|
Signed-off-by: crazycs <[email protected]>
@djshow832 @winoros @ClSlaid PTAL |
/run-all-tests |
Signed-off-by: crazycs <[email protected]>
/LGTM |
@ClSlaid: Please use GitHub review feature instead of For the reason we drop support to the commands, see also this page. 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 ti-community-infra/tichi repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@ClSlaid: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this:
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 ti-community-infra/tichi repository. |
/run-all-tests |
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 4cf9788
|
What problem does this PR solve?
Before this PR, query the
statemens summary
table maybe very slow cause by decode plan, event the query doesn't need to read theplan
.Bench
Generate 3000 statements to filling
statemens summary
, and each SQL length is10240 byte
.Use loadgen to generated load:
The generated SQL is look like this:
Wait generated statements(SQL) fill in the
statemens summary
.Bench the SQL:
select count(*) from information_schema.cluster_statements_summary_history;
Bellow is the bench result compare with the master:
Related TiDB memory consume metric is below:
Master:
This PR:
# What is changed and how it works?
This PR add a special
stmtSummaryReader
to read thestatemens summary
table data, and only'decode'
the needed column, avoid decode plan for each table row.Also, this PR implements
prune columns
forLogicalMemTable
if themem table
isstatemens summary
table. Otherwise,stmtSummaryReader
still has to read all column sinceLogicalMemTable
doesn'tprune column
.Related changes
Check List
Tests
Side effects
Release note