Creating a user-defined optimization goal

Use sp_optgoal to create a user-defined optimization goal. The syntax is:

sp_optgoal "goal_name", "save"

where:

See the Reference Manual: Procedures.

Example

This example creates a goal called goal_1571, which:

  1. Sets the optimization level to ase157ga

  2. Sets the optimization goal to allrows_mix

  3. Enables hash joins

  4. Enables the optimization criteria for CR # 123456

  5. Disables the optimization criteria for CR # 234234:

set plan optlevel ase157ga
set plan optgoal allrows_mix
set hash_join 1
set CR123456 1
set CR234234 0
go
execute sp_optgoal "goal_1571", "save"
go