Implementation and optimization of grouping with DB2® Multisystem
The implementation method for grouping in queries that use distributed
files is dependent on whether the partitioning key is included in the grouping
criteria.
Grouping is implemented using either one-step grouping
or two-step grouping.
One-step grouping with DB2 Multisystem
If all the fields from the partitioning key are GROUP BY fields, then grouping can be performed using one-step grouping, because all of the data for the group is on the same node.
Two-step grouping with DB2 Multisystem
If the partitioning key is not included in the grouping fields, then grouping must be done using two-step grouping, because the like values of a field are not located on the same node.
Grouping and joins with DB2 Multisystem
If the query contains a join, the partitioning key used to determine the type of grouping that can be implemented is based on any repartitioning of data that was required to implement the join.