Sort Specification
The Sort Specification property for a business component, picklist,
or predefined query orders the records retrieved in a query, and serves
as the basis for the ORDER BY
clause in the resulting
SQL issued. An index needs to be present that supports the order specified
in the sort specification. Otherwise, the RDBMS engine physically sorts
the entire result set in a temporary table.
The index needs to include the base columns for all of the fields, and to use them in the same order. There can be more columns specified in the index than are used in the sort specification, but the reverse is not true.
For example, the sort specification Last Name, First Name in the Contact
business component is supported by at least one index on the S_CONTACT
base table. One of these indexes is called S_CONTACT_U1
,
and it contains the LAST_NAME
, FST_NAME
,
MID_NAME
, PR_DEPT_OU_ID
, OWNER_PER_ID
,
and CONFLICT_ID
columns, in that order. If you want
a sort specification that orders contacts in first-name order, then you
would need to create a custom index.
Do not sort on joined columns, because indexes cannot be used.