-
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
executor, planner, util: optimize query statements summary table by conditional pushdown #27563
Conversation
[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. |
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.
Got panic when i query following query:
select digest from `STATEMENTS_SUMMARY` where digest='';
1f2d42b
to
5421e9d
Compare
…void decode plan by conditional pushdown Signed-off-by: Zijie Lu <[email protected]>
Signed-off-by: Zijie Lu <[email protected]>
/rebuild |
Signed-off-by: Zijie Lu <[email protected]>
Signed-off-by: Zijie Lu <[email protected]>
Signed-off-by: Zijie Lu <[email protected]>
/run-all-tests |
@djshow832 @jyz0309 PTAL |
@qw4990 @djshow832 PTAL |
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.
Please modify the PR title: it doesn't avoid decoding plans.
Signed-off-by: Zijie Lu <[email protected]>
infoschema/tables_test.go
Outdated
// Test explain | ||
tk.MustQuery("explain select digest from information_schema.statements_summary where digest is null").Check(testkit.Rows(`Selection_5 8000.00 root isnull(Column#5)`, `└─MemTableScan_6 10000.00 root table:STATEMENTS_SUMMARY `)) |
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.
You can add following test in executor/explainfor_test.go
.
func (s *testSuite) TestExplainStatementsSummary(c *C) {
tk := testkit.NewTestKitWithInit(c, s.store)
tk.MustQuery("desc select * from information_schema.statements_summary").Check(testkit.Rows(
`MemTableScan_4 10000.00 root table:STATEMENTS_SUMMARY `))
tk.MustQuery("desc select * from information_schema.statements_summary where digest is null").Check(testutil.RowsWithSep("|",
`Selection_5|8000.00|root| isnull(Column#5)`, `└─MemTableScan_6|10000.00|root|table:STATEMENTS_SUMMARY|`))
tk.MustQuery("desc select * from information_schema.statements_summary where digest = 'abcdefg'").Check(testutil.RowsWithSep(" ",
`MemTableScan_5 10000.00 root table:STATEMENTS_SUMMARY digests: ["abcdefg"]`))
tk.MustQuery("desc select * from information_schema.statements_summary where digest in ('a','b','c')").Check(testutil.RowsWithSep(" ",
`MemTableScan_5 10000.00 root table:STATEMENTS_SUMMARY digests: ["a","b","c"]`))
}
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.
done
/run-all-tests |
@djshow832 PTAL |
Please resolve conflicts @TszKitLo40 |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: aec6347
|
Signed-off-by: Zijie Lu [email protected]
What problem does this PR solve?
Issue Number: close #26379
Bench:
Generate 3000 statements to filling
statemens summary
, and each SQL length is10240 byte
.Use loadgen to generated load:
bin/loadgen payload gen-stmt --stmt-cnt 3000 --query-len 10240 --host 172.16.5.40 --port 4019 --concurrency 10
The generated SQL is look like this:
select * from t_gen_stmt_1 where a = 1 or b = 1 or c = 1 union all select * from t_gen_stmt_2 where a = 2 or b = 2 or c = 2 union all ... ... ...
Wait generated statements(SQL) fill in the statemens summary.
Bench the SQL: select * from information_schema.cluster_statements_summary where digest = 'xxx';
Bellow is the bench result compare with the master:
Problem Summary:
What is changed and how it works?
What's Changed:
optimize query statements summary table by avoid decode plan by conditional pushdown
How it Works:
By using conditional pushdown, filter the digest in logical optimization phase.
Check List
Tests
Side effects
Documentation
Release note