Contents Index Ordered group by Single group by

ASA SQL User's Guide
  Query Optimization and Execution
    Query execution algorithms
      Grouping

Indexed group by

The indexed group by algorithm is similar to the indexed distinct algorithm. It builds a work table containing one row per group. As input rows are read, the associated group is looked up in the work table using an index. The aggregate functions are updated, and the group row is rewritten to the work table. If no group record is found, a new group record is initialized and inserted into the work table.

Indexed group by is chosen when the optimizer is reasonably certain that the size of the input is very small.

The indexed group by computes all the rows of its result before returning the first row, and fully materializes its input. It can be used to satisfy a FULLY INSENSITIVE requirement.


Contents Index Ordered group by Single group by