(Contents)(Previous)(Next)

ORDERED SELECT Statements (single row processing)

Since these statements do not use any storage space, this section only explains the way in which runtime can be shortened.

Every single row SELECT can be performed by means of the sequential search starting from the FIRST/LAST row or from the row identified by a key up to the first row which fulfills the condition. It is obvious that all available information about key ranges should be specified in order to reduce the number of rows to be searched through.

The syntax of the single row SELECT permits the specification of the lower limit (SELECT NEXT) of a key range as well as the specification of an upper limit (search condition). For SELECT FIRST/LAST it is possible to specify both limits in the search condition. For SELECT NEXT/PREV only the limit which is not specified in the <key spec list> is found from the search condition.

To find the rows which meet a specified condition, it is better to apply an index than to perform a sequential search.

If the index is directly specified in the program with INDEX or INDEXNAME, it must always be used for the search. If no index is specified, any index can be used for which the ADABAS optimizer finds equality conditions so that exactly one index list is designated.

Examples:

In this example, the range between 3,0 and 70,20 is searched through.

The index of INVCOLUMN1 is used and every index list, starting from 'Miller', is processed, if necessary.

The index of INVCOLUMN1 is used. Only the index list with the value 'Miller' is processed, not all the index lists with values greater than 'Miller'.


(Contents)(Previous)(Next)