-
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
[enhancement](Nereids) Speedup PartitionPrunner #31970
Conversation
Thank you for your contribution to Apache Doris. |
run buildall |
Any performance data? |
5d0a639
to
08c4e0f
Compare
run buildall |
run buildall |
100 threads parallel continuous send this sql which query an empty table, test in my mac machine(m2 chip, 8 core) select count(1),date_format(time_col,'%Y%m%d'),varchar_col1
from tbl
where partition_date>'2024-02-15' and (varchar_col2 ='73130' or varchar_col3='73130') and time_col>'2024-03-04'
and time_col<'2024-03-05'
group by date_format(time_col,'%Y%m%d'),varchar_col1
order by date_format(time_col,'%Y%m%d') desc, varchar_col1 desc,count(1) asc
limit 1000 before: 1600 peak QPS, about 1300 avg QPS |
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
this.slotToType = IntStream.range(0, partitionSlots.size()) | ||
.mapToObj(index -> Pair.of(partitionSlots.get(index), partitionSlotTypes.get(index))) | ||
.collect(ImmutableMap.toImmutableMap(Pair::key, Pair::value)); | ||
this.slotToType = Maps.newHashMapWithExpectedSize(partitionSlots.size() * 2); |
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.
Minor: use Maps.newHashMapWithExpectedSize(partitionSlots.size()); may good enough, can update the code in next pr
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.
I will change to 16 in next pr, because the num of partitionSlots usually <= 3
This pr imporve the high QPS query by speed up PartitionPrunner 1. remove useless Date parse/format, use LocalDate instead 2. fast evaluate path for single value partition 3. change Collection.stream() to ImmutableXxx.builderWithExpectedSize(n) to skip useless method call and collection resize 4. change lots of if-else to switch 5. don't parse to string to compare dateLiteral, use int field compare instead
Proposed changes
This pr imporve the high QPS query by speed up PartitionPrunner
LocalDate
insteadCollection.stream()
toImmutableXxx.builderWithExpectedSize(n)
to skip useless method call and collection resize