SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
P-22
Plans
Plans
A plan (also called an execution plan or a query execution plan) is an execution
method for a single compiled SQL statement. A plan captures both the semantics and
execution characteristics of the statement. Compiled programs typically include many
plans. Each plan might be operable or inoperable, optimal or not optimal, and valid or
invalid.
An operable plan is a plan that will give correct results for a given set of database
tables. An inoperable plan is one whose execution would cause an error, an incorrect
query result, or a corruption of the database.
An optimal plan is an operable plan that is also the most efficient plan for processing
the statement against a given set of database tables. Not all operable plans are
optimal plans. An optimal plan for one set of tables might be operable, but not optimal,
for a different, but similar, set of tables.
An invalid plan is a plan considered invalid by SQL because changes made after the
plan was compiled might have made the plan inoperable or not optimal. A plan is
invalid, for example, if an object referenced in the plan was redefined after the plan
was last compiled.
A plan can also be invalid for a specific program startup—but not generally invalid—if
the startup-time value of a DEFINE referenced in the plan is different from the value of
that DEFINE at the time the plan was compiled.
An invalid plan can also be an operable plan if the set of tables for which the plan was
compiled is similar to the set of tables associated with the plan at execution time. For
information about the differences permitted between such tables, see Similarity Checks
on page S-54.
An altered plan is an invalid but operable plan that the SQL compiler has updated to
use a different set of tables without actually recompiling the plan itself.
For more information about plans, see the SQL/MP Query Guide.