Skip to content
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

ESQL: Run aggregations in SINGLE mode when possible #119955

Open
nik9000 opened this issue Jan 10, 2025 · 2 comments
Open

ESQL: Run aggregations in SINGLE mode when possible #119955

nik9000 opened this issue Jan 10, 2025 · 2 comments
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@nik9000
Copy link
Member

nik9000 commented Jan 10, 2025

Description

When you run an aggregation on the coordinating node with ESQL right now you get a plan like:

{
  "operator": "HashAggregationOperator[blockHash=PackedValuesBlockHash{groups=[0:BYTES_REF, 14:BYTES_REF, 15:BYTES_REF, 1:BYTES_REF], entries=1267, size=208.1kb}, aggregators=[GroupingAggregator[aggregatorFunction=MaxBytesRefGroupingAggregatorFunction[channels=[2]], mode=INITIAL], GroupingAggregator[aggregatorFunction=MaxBytesRefGroupingAggregatorFunction[channels=[3]], mode=INITIAL], GroupingAggregator[aggregatorFunction=MaxLongGroupingAggregatorFunction[channels=[4]], mode=INITIAL], GroupingAggregator[aggregatorFunction=MaxBytesRefGroupingAggregatorFunction[channels=[19]], mode=INITIAL], GroupingAggregator[aggregatorFunction=MaxBytesRefGroupingAggregatorFunction[channels=[18]], mode=INITIAL], GroupingAggregator[aggregatorFunction=MaxBytesRefGroupingAggregatorFunction[channels=[16]], mode=INITIAL], GroupingAggregator[aggregatorFunction=MaxBytesRefGroupingAggregatorFunction[channels=[17]], mode=INITIAL]]]",
  "status": {
    "hash_nanos":        7318931,
    "aggregation_nanos": 7684744,
    "pages_processed": 39
  }
},
{
  "operator": "HashAggregationOperator[blockHash=PackedValuesBlockHash{groups=[0:BYTES_REF, 1:BYTES_REF, 2:BYTES_REF, 3:BYTES_REF], entries=1267, size=208.1kb}, aggregators=[GroupingAggregator[aggregatorFunction=MaxBytesRefGroupingAggregatorFunction[channels=[4, 5]], mode=FINAL], GroupingAggregator[aggregatorFunction=MaxBytesRefGroupingAggregatorFunction[channels=[6, 7]], mode=FINAL], GroupingAggregator[aggregatorFunction=MaxLongGroupingAggregatorFunction[channels=[8, 9]], mode=FINAL], GroupingAggregator[aggregatorFunction=MaxBytesRefGroupingAggregatorFunction[channels=[10, 11]], mode=FINAL], GroupingAggregator[aggregatorFunction=MaxBytesRefGroupingAggregatorFunction[channels=[12, 13]], mode=FINAL], GroupingAggregator[aggregatorFunction=MaxBytesRefGroupingAggregatorFunction[channels=[14, 15]], mode=FINAL], GroupingAggregator[aggregatorFunction=MaxBytesRefGroupingAggregatorFunction[channels=[16, 17]], mode=FINAL]]]",
  "status": {
    "hash_nanos":         838334,
    "aggregation_nanos": 1164512,
    "pages_processed": 1
  }
},

It feels like the second one is just a waste. In this particular query we're only burning 2ms, but this feels like it'd be much bigger for bigger queries.

@nik9000 nik9000 added >enhancement needs:triage Requires assignment of a team area label labels Jan 10, 2025
@mayya-sharipova mayya-sharipova added :Analytics/ES|QL AKA ESQL and removed needs:triage Requires assignment of a team area label labels Jan 10, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jan 10, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@dnhatn
Copy link
Member

dnhatn commented Jan 11, 2025

+1. I had #106148 for both aggregation and topN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

No branches or pull requests

4 participants