SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
U-7
UPDATE STATISTICS Statement
UPDATE STATISTICS Statement
UPDATE STATISTICS is a DDL statement that updates the statistics stored in the
catalog for the specified table. SQL does not automatically update statistics; you must
execute this statement to have current statistics in your catalog.
ALL
requests updated statistics for all columns in the table.
If you do not specify ALL, statistics are updated only for columns that make up the
primary or clustering key of the table and columns specified in any index on the
table.
table
is the name of the table for which to update statistics.
RECOMPILE | NO RECOMPILE
specifies whether to invalidate program files that use the table affected by the
UPDATE STATISTICS operation:
RECOMPILE is the default behavior. SQL uses the RECOMPILE option if you do
not specify either option.
Only recompiled programs can take advantage of the new statistics. Invalidating
programs forces recompilation unless the programs were compiled with the
CHECK INOPERABLE PLANS option. SQL automatically recompiles an invalid
program at execution time (unless you specified options to restrict recompilation
when you originally compiled it), but you need to explicitly recompile each program
to revalidate it.
If you specify RECOMPILE, you might want to use VERIFY to display the names of
invalid programs. See VERIFY Command on page V-2.
SIMPLE | PROBABILISTIC
specifies whether to compute statistics using a new internal algorithm, called
PROBABILISTIC, or the algorithm used in previous RVUs of NonStop SQL/MP,
called SIMPLE.
UPDATE [ ALL ] STATISTICS FOR TABLE table
[ RECOMPILE ] [ SIMPLE ] [ EXACT ]
[ NO RECOMPILE ] [ PROBABILISTIC ] [ SAMPLE n BLOCKS ]
RECOMPILE invalidates program files, but if table has SIMILARITY
CHECK ENABLED, does not invalidate files compiled with
CHECK INOPERABLE PLANS.
NO RECOMPILE does not invalidate the program files.