Optimization-Goal Directives
Element | Description | Restrictions | Syntax |
---|---|---|---|
comments | Text documenting the directive | Must appear between comment symbols | Character string |
- FIRST_ROWS
This tells the optimizer to choose a plan that optimizes the process of finding only the first screenful of rows that satisfies the query. Use this option to decrease initial response time for queries that use an interactive mode or that require the return of only a few rows.
- ALL_ROWS
This directive tells the optimizer to choose a plan that optimizes the process of finding all rows that satisfy the query.
This form of optimization is the default.
An optimization-goal directive takes precedence over the OPT_GOAL environment variable setting and over the OPT_GOAL configuration parameter.
For information about how to set the optimization goal for an entire session, see the SET OPTIMIZATION statement.
- In a view definition
- In a subquery
SELECT {+FIRST_ROWS
Return the first screenful of rows as fast as possible}
LIMIT 50 fname, lname FROM employees ORDER BY bonus DESC;