-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[fix](statistics)Control memory use for sample partition column and key column. #46534
Conversation
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
run buildall |
TPC-H: Total hot run time: 32583 ms
|
TPC-DS: Total hot run time: 197364 ms
|
ClickBench: Total hot run time: 30.77 s
|
run buildall |
TPC-H: Total hot run time: 32498 ms
|
TPC-DS: Total hot run time: 196034 ms
|
ClickBench: Total hot run time: 30.86 s
|
run external |
fe/fe-core/src/main/java/org/apache/doris/statistics/OlapAnalysisTask.java
Outdated
Show resolved
Hide resolved
65ec2c6
to
701042f
Compare
run buildall |
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
TPC-H: Total hot run time: 33036 ms
|
TPC-DS: Total hot run time: 194290 ms
|
ClickBench: Total hot run time: 31.1 s
|
Refactor doSample function.
run buildall |
TPC-H: Total hot run time: 32564 ms
|
TPC-DS: Total hot run time: 195261 ms
|
ClickBench: Total hot run time: 31.59 s
|
PR approved by at least one committer and no changes requested. |
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
What problem does this PR solve?
When doing sample analyze for partition column and key column, BE may encounter OOM problem. The reason is, partition column need to choose at least one tablet in each partition to calculate the NDV and couldn't use limit in the SQL, so when the table has large number of partitions and each tablet in each partition is quite large, the sample SQL may try to read too many data which will cause BE OOM.
Similarly, key column couldn't use limit as well, so when one tablet is very large, it also could cause OOM.
This pr is try to solve this problem.
For partition columns, when the selected tablets contain more than 1000000000 (one billion) rows, we use ndv() function to read up to 5 partitions to get the NDV value of this 5 partitions, say the ndv is n. Suppose the row count in the 5 partitions is r, and the row count of tje table is R, the table NDV would be n * R / r.
ndv() function use hll, so it only use a small amount of memory.
For key columns, when the selected tablets contain more than 1000000000 rows, we use limit 1000000000 to control the rows to read.
Reading 1000000000 rows would use at most 8GB memory in BE, which is acceptable.
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)