Using Current Statistics - HP NonStop SQL/MP Programming Manual

For c
Table of Contents

Advertisement

Explicit Program Compilation
If the program has not been previously compiled or if the program does not
contain similarity information, the COMPILE INVALID PLANS option directs the
SQL compiler to compile all SQL statements in the program.
COMPILE INOPERABLE PLANS
directs the SQL compiler to explicitly compile these SQL statements:
Statements with inoperable plans (invalid plans that fail the similarity
check).
Uncompiled statements with empty sections. The SQL compiler generates
an empty section if an SQL statement references a nonexistent DEFINE or
SQL object. (The SQL compiler also generates empty sections for
CONTROL directives and DDL statements.)
Other SQL statements retain their existing execution plans.
The COMPILE INOPERABLE PLANS option stores similarity information in the
program file and updates the program's name map and usages in the
USAGES tables. If the program has not been previously compiled or if the
program does not contain similarity information, the COMPILE INOPERABLE
PLANS option directs the SQL compiler to compile all SQL statements in the
program.
Note. Safeguard protection for a program object file might be lost after SQL compilation in
certain cases. For example, if the PROGID bit is set for the file or if the original program cannot
be modified because it is held open, you must explicitly restore Safeguard protection after SQL
compilation.

Using Current Statistics

For the SQL compiler to generate the best execution plan, it must have the current
statistics for referenced tables. NonStop SQL/MP does not automatically update these
statistics. A program must run the UPDATE STATISTICS statement to generate current
statistics in a catalog.
To run the UPDATE STATISTICS statement, a program's PAID must meet this criteria:
Have read access to the table and write access to the catalogs that contain the
table descriptions
Be the local owner of the table or a remote owner with purge access to the table
(or be the local super ID user)
In this example, the first statement updates the statistics for all columns in the
ORDERS table. The second statement updates the statistics columns in the primary
key or clustering key or in any indexes for the ODETAIL table.
EXEC SQL UPDATE ALL STATISTICS FOR TABLE =orders;
EXEC SQL UPDATE STATISTICS FOR TABLE =odetail;
HP NonStop SQL/MP Programming Manual for C—429847-008
Running the SQL Compiler in the Guardian
6-21
Environment

Advertisement

Table of Contents
loading

Table of Contents