-
Notifications
You must be signed in to change notification settings - Fork 753
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
refactor: Optimize When Querying the tables_history Table with the Condition table_id = n #17166
Conversation
This pull request's title is not fulfill the requirements. @TCeason please update it 🙏. Valid format:
Valid types:
|
1 similar comment
This pull request's title is not fulfill the requirements. @TCeason please update it 🙏. Valid format:
Valid types:
|
Docker Image for PR
|
ClickBench Report |
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.
Reviewed 13 of 14 files at r1, all commit messages.
Reviewable status: 13 of 14 files reviewed, 3 unresolved discussions (waiting on @b41sh and @TCeason)
src/query/storages/system/src/tables_table.rs
line 359 at r1 (raw file):
.into_iter() .flatten() .filter(|table| !tables_names.contains(table))
Make tables_names
a BTreeSet
of HashSet
. Otherwise for large dataset the O(n^2)
time complexity for linear lookup might hang the query.
And it does not need filter()
anymore. just call extend()
to add new table names.
src/query/storages/system/src/tables_table.rs
line 366 at r1 (raw file):
Err(err) => { warn!("Failed to get tables: {}, {}", ctl.name(), err); }
Why just warning it but not returning an error? It could be a severe error.
Code quote:
Err(err) => {
warn!("Failed to get tables: {}, {}", ctl.name(), err);
}
src/query/storages/system/src/tables_table.rs
line 451 at r1 (raw file):
Err(err) => { let msg = format!("Failed to get tables: {}, {}", ctl.name(), err); warn!("{}", msg);
Return the error instead of just warning about it.
Code quote:
let msg = format!("Failed to get tables: {}, {}", ctl.name(), err);
warn!("{}", msg);
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.
Reviewable status: 13 of 14 files reviewed, 3 unresolved discussions (waiting on @b41sh and @drmingdrmer)
src/query/storages/system/src/tables_table.rs
line 359 at r1 (raw file):
Previously, drmingdrmer (张炎泼) wrote…
Make
tables_names
aBTreeSet
ofHashSet
. Otherwise for large dataset theO(n^2)
time complexity for linear lookup might hang the query.And it does not need
filter()
anymore. just callextend()
to add new table names.
Done.
src/query/storages/system/src/tables_table.rs
line 366 at r1 (raw file):
Previously, drmingdrmer (张炎泼) wrote…
Why just warning it but not returning an error? It could be a severe error.
system tables needs as many output results as possible, and even though the result set may be empty, the business does not want to report errors. If an unexpected result set appears, it can be screened through the log audit function
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.
Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @b41sh)
src/query/storages/system/src/tables_table.rs
line 366 at r1 (raw file):
Previously, TCeason wrote…
system tables needs as many output results as possible, and even though the result set may be empty, the business does not want to report errors. If an unexpected result set appears, it can be screened through the log audit function
Get it
src/query/storages/system/src/tables_table.rs
line 451 at r1 (raw file):
Previously, drmingdrmer (张炎泼) wrote…
Return the error instead of just warning about it.
Same as the above conclusion.
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.
Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @b41sh)
Docker Image for PR
|
ClickBench Report |
Docker Image for PR
|
ClickBench Report |
cc @BohuTANG Please merge this pr. All ci pass and was not impact on performance. |
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.
Reviewed all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @TCeason)
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
Tests
Type of change
This change is