SQL/MP Installation and Management Guide

Managing Database Applications
HP NonStop SQL/MP Installation and Management Guide523353-004
10-9
Automatic Recompilation
that are invalid because objects they reference have been changed or redefined) are
actually operable plans.
Performance Considerations
Performance is best if you ensure that programs do not need recompilation at run time.
Some programs can be marked valid and still require automatic recompilation, so plan
to eliminate as many causes of automatic recompilation as possible, as described
under Program Validity on page 10-1. Options are available that govern the extent of
recompilation for an application; these options are discussed in this subsection.
Monitor programs that are automatically recompiled because of unavailable objects so
that you can restart the programs when the object becomes available. If you are
running applications in a Pathway environment, for example, you can stop and restart
the server class to initiate use of the program version with the best access path. For
other programs, stop and restart the programs.
SQL Compiler Options for Recompilation
These compiler options control whether recompilation occurs:
RECOMPILE specifies that if the program becomes invalid, the system is to
recompile either the whole program or the SQL statements used, depending on the
choice of the RECOMPILEALL or RECOMPILEONDEMAND option. RECOMPILE
sets the AUTOCOMPILE flag in the PROGRAMS table to Y. This option is the
default.
For continuous access to your database or for local autonomy in a distributed
database, use RECOMPILE to ensure:
°
Programs run if access paths are available although database changes
occurred since the programs were explicitly compiled.
°
You have local autonomy because the system can automatically recompile
programs to determine access paths if access paths through other systems
become unavailable.
NORECOMPILE specifies that if the program becomes invalid, the system cannot
automatically recompile it. The resulting program file cannot run if the program
becomes invalid or if tables or indexes become unavailable. NORECOMPILE sets
the AUTOCOMPILE flag in the PROGRAMS table to N.
To control recompilations by detecting the occurrence of an invalid program
immediately, use NORECOMPILE. This option ensures that any cause of invalidity
is immediately detected, because an invalid program cannot run. With
Note. An operable plan, while executable, might not be optimal—and that recompilation might
improve performance. For more information, see Using Similarity Checks on page 10-15.