Changes to abstract plans

The abstract plan syntax, used by Adaptive Server Enterprise to force the query plan chosen by the optimizer, has been extended to allow several query-level settings, that were previously available only at the session level. The optimization criteria are handled at the session level by the following set statements:

set
		 nl_join|merge_join|hash_join|...
		 0|1

The use ... abstract plan syntax has been extended to accept any number of use forms before the abstract plan derived table. Previously, optgoal and opttimeout could not be in the same abstract plan with a derived table. For example, this statement would need to be separate from a optgoal statement in a query:

 select ...
		 plan
		 “(use opttimeoutlimit 10) (i_scan r)”

However, with Adaptive Server 15.0.1, you can include several statements in the same abstract plan in two ways:

At the query level, use the optimization goal (opt_goal) or timeout (opttimeout) setting with the use ... abstract plan syntax. At the session level, use these settings with the set plan ... syntax:

For example, join r outer to s and enable the hash_join without an optimization goal (opt_goal):

select ...
> 
>          plan
> 
>             “(use hash_join on)
> 
>             (join (scan r) (scan s))”

This example uses the opt_goal and allrows_oltp statements, but with hash_join enabled:

select ...
> 
>     plan
> 
>        “(use opt_goal allrows_oltp)(use hash_join on)”

When setting the optimization goal and the optimization criteria at the query level, the order of the use statements does not affect the outcome.