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
Add Exchange before GroupId to improve Partial Aggregation #105
Add Exchange before GroupId to improve Partial Aggregation #105
Conversation
The idea was abandoned during prestodb/presto#11267 review.
8a9c180
to
ca60479
Compare
.map(newAggregation -> { | ||
PlanNode newProject = project.replaceChildren(ImmutableList.of(newAggregation)); | ||
PlanNode newExchange = exchange.replaceChildren(ImmutableList.of(newProject)); | ||
return Result.ofPlanNode(newExchange); |
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 would inline these, then structure of the code matches the structure of the plan.
|
||
double aggregationMemoryRequirements = estimateAggregationMemoryRequirements(groupingKeys, groupId, groupingSetHistogram, context); | ||
if (isNaN(aggregationMemoryRequirements) || aggregationMemoryRequirements < maxPartialAggregationMemoryUsage.toBytes()) { | ||
// Aggregation will be effective even without exchanges. |
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.
it is not true when isNaN(aggregationMemoryRequirements)
* GroupId (before multiplication) makes partial aggregation more effective, resulting in less data being | ||
* exchanged afterwards. | ||
*/ | ||
public class AddExchangesBelowPartialAggregationOverGroupIdRuleSet |
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.
It would be nice to have unit test for that
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.
That would probably be actually useless -- prestodb/presto#11741 (comment)
@@ -267,6 +268,7 @@ private LocalQueryRunner(Session defaultSession, FeaturesConfig featuresConfig, | |||
requireNonNull(defaultSession, "defaultSession is null"); | |||
checkArgument(!defaultSession.getTransactionId().isPresent() || !withInitialTransaction, "Already in transaction"); | |||
|
|||
this.taskManagerConfig = new TaskManagerConfig().setTaskConcurrency(4); |
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.
do we need that really?
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.
need what? this only extracts TaskManagerConfig
to a variable. I will separate this into preparatory commit
ca60479
to
d7def7d
Compare
The rule brings significant improvement in TPC-DS Q22 and Q67 while not causing much regression in other TPC-H, TPC-DS queries. (The only observably regressing queries were still much better than non-CBO baseline.)
cd5fc64
to
270f8a3
Compare
Ref prestodb/presto#11741