Teradata Join Optimization: Early and Partial GROUP BY Techniques for Decision Support Workload

Teradata applies two very effective join optimization methods for decision support workloads, which usually involve a lot of aggregations:

Teradata GROUP BY-  Early and Partial Aggregation

Early and Partial GROUP BY are transformations that allow moving group operations in front of one or more join operations.

While Early GROUP BY executes the group statement, as a whole, before the join, Partial GROUP BY divides the aggregation, doing the first part of the aggregation before the join and the second part after.

This technique reduces resource usage for the join and the aggregation after the join (in the case of Early GROUP BY, no aggregation needs to be done after the join at all).

The Early Aggregation technique is used to reduce the number of rows as early as possible.

Whether the optimizer applies this technique depends on the estimated join costs.

Consider the following SQL query:

SELECT SUM(t01.a)
FROM t01,t02,t03
WHERE t01.b = t02.b AND t02.c = t03.c
GROUP BY t01.d
;

This SQL exemplifies how the Teradata optimizer can partially group t01 by columns {t01.b, t01.d} by pushing the GROUP BY into relation t01.

The spool group can then be joined with relation t02. Finally, the resulting spool will be combined with t03, and a final GROUP BY will be applied.

Early and Partial GROUP BY, despite their complexity in execution plan creation, are commonly employed methods in modern database systems for data reduction. These approaches provide additional join options to the optimizer.

Partial grouping can be detected by looking at the EXPLAIN plan:

  • Explicitly stated: “We do an all-AMPs partial SUM step” or
  • Before the join takes place:  “we do a SORT/GROUP”

It is necessary to gather statistics on all columns involved in joins and aggregations to increase the likelihood of the optimizer utilizing these techniques.

Related Services

⚡ Need Help Optimizing Your Data Platform?

We cut data platform costs by 30–60% without hardware changes. 25+ years of hands-on tuning experience.

Explore Our Services →

📋 Considering a Move From Teradata?

Get a personalized migration roadmap in 2 minutes. We have migrated billions of rows from Teradata to Snowflake, Databricks, and more.

Free Migration Assessment →

📊 Data Platform Migration Survey

Help us map where the industry is heading. Results are public — see what others chose.

1. What is your current data platform?

2. Where are you migrating to (or evaluating)?

Migrating FROM
Migrating TO

Thanks for voting! Share this with your network.

Follow me on LinkedIn for daily insights on data warehousing and platform migrations.

Stay Ahead in Data Warehousing

Get expert insights on Teradata, Snowflake, BigQuery, Databricks, Microsoft Fabric, and modern data architecture — delivered to your inbox.

1 thought on “Teradata Join Optimization: Early and Partial GROUP BY Techniques for Decision Support Workload”

  1. Thanks for explaining, how would early group by being classified and how could it be identified through explain plan.

    Reply

Leave a Comment

DWHPro

Expert network for enterprise data platforms. Senior consultants, project teams built for your challenge — across Teradata, Snowflake, Databricks, and more.

📍Vienna, Austria & Jacksonville, Florida

Quick Links
Services Team Teradata Book Blog Contact Us
Connect
LinkedIn → [email protected]
Newsletter

Join 4,000+ data professionals.
Weekly insights on Teradata, Snowflake & data architecture.