Expand description
Aggregation Execution Plan Module
This module generates execution plans for GROUP BY queries with aggregations.
§Execution Plan Flow
GraphQL Query
↓
AggregationRequest (parsed)
↓
AggregationPlan (validated, optimized)
↓
SQL Generation (database-specific)
↓
Query Execution§Example
query {
sales_aggregate(
where: { customer_id: { _eq: "uuid-123" } }
groupBy: { category: true, occurred_at_day: true }
having: { revenue_sum_gt: 1000 }
) {
category
occurred_at_day
count
revenue_sum
revenue_avg
}
}Generates:
SELECT
data->>'category' AS category,
DATE_TRUNC('day', occurred_at) AS occurred_at_day,
COUNT(*) AS count,
SUM(revenue) AS revenue_sum,
AVG(revenue) AS revenue_avg
FROM tf_sales
WHERE customer_id = $1
GROUP BY data->>'category', DATE_TRUNC('day', occurred_at)
HAVING SUM(revenue) > $2Structs§
- Aggregation
Plan - Validated and optimized aggregation execution plan
- Aggregation
Planner - Aggregation plan generator
- Aggregation
Request - Aggregation request from GraphQL query
- Having
Condition - HAVING condition (post-aggregation filter)
- Order
ByClause - ORDER BY clause
- Validated
Having Condition - Validated HAVING condition
Enums§
- Aggregate
Expression - Validated aggregate expression
- Aggregate
Selection - Aggregate selection (what to compute)
- Group
ByExpression - Validated GROUP BY expression
- Group
BySelection - GROUP BY selection
- Order
Direction - Sort direction