FOCUS aggregation verbs SUM, COUNT, and WRITE, and direct
operators MIN., MAX., and AVE., retrieve a final aggregated answer
set rather than individual values. Since the RDBMS handles aggregation
efficiently, the adapter structures its retrieval request so that
the RDBMS performs the aggregation. The adapter passes aggregation
to the RDBMS when:
- The IF or WHERE tests in the FOCUS request translate to
SQL WHERE clauses. (Use STMTRACE, described in Tracing Adapter Processing, to
examine the SQL generated from your request.)
- FOCUS generates a single SQL statement (as described in Optimizing Joins).
- Adapter-managed join optimization is not in effect (see Optimizing Joins).
- The request specifies only the FOCUS SUM, COUNT, or WRITE aggregate
verbs and the MIN., MAX., AVE., SUM., DST., and CNT. direct operators.
Under certain conditions (described in Optimizing Sorts), the
request can include the FOCUS FST. and LST. direct operators.
- The request does not reference DEFINE fields that do not comply
with the definition of valued expressions (see Valued Expressions)
or that are otherwise restricted (see SQL Limitations on Optimization of DEFINE Expressions).
Note: FOCUS calculates COMPUTE fields on its internal
matrix. They do not affect the ability of the adapter to pass requests
for aggregation to the RDBMS.
The adapter translates IF TOTAL and WHERE TOTAL tests to the
SQL HAVING clause. It translates IF TOTAL and WHERE TOTAL tests
on DEFINE and COMPUTE fields subject to the general limitations
on the use of DEFINE in aggregation (see Valued Expressions).