Next, if the request specifies a sort operation, the adapter must determine how to sort the data. The adapter transfers the sort operation to the RDBMS only when:
For a discussion of these conditions, see Optimizing Joins.
Under these conditions, the adapter invokes one of the following types of RDBMS-managed sorting:
FOCUS FST. and LST. operators retrieve the first or last segment instance per sort break. By definition, if a FOCUS request includes FST. or LST. operators on multiple fields from one segment, each field value displayed on the resulting report must come from the same instance of that segment. SQL MIN and MAX operators do not dictate that the resulting fields all come from the same segment instance.
Therefore, before translating the FST. and LST. operators in a FOCUS request to SQL MIN and MAX operators, the adapter must ascertain that it will retrieve at most one segment instance per sort break. It makes this determination by analyzing the sort fields in the request, the primary key of each segment in the join structure, and any join fields that are components of the primary keys.
One segment instance is returned per sort break in any of the following situations:
Note: LST. processing is invoked for SUM or WRITE operations involving alphanumeric or date fields and for alphanumeric or date fields in a report heading or footing.
From a performance standpoint, consider using the TABLEF command in conjunction with RDBMS-managed sorting to free FOCUS from having to verify the sort order. Refer to Advanced Reporting Techniques, for the TABLEF command.
Information Builders |