NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
U-11
Examples—UPDATE STATISTICS
prevent it from occurring at all by executing UPDATE STATISTICS at least once
for any partitioned table.
Transactions
When your table has many partitions—for example, 100—you might want to avoid
putting the UPDATE STATISTICS statement in a user-defined TMF transaction.
With many partitions, the UPDATE STATISTICS operation might take so long that
TMF might have too little log file space to perform all the logging required by other
TMF transactions at the time.
If no user-defined TMF transaction is in progress when UPDATE STATISTICS
executes, SQL starts several for the operation but does not include scanning the
table for information within a transaction. Because UPDATE STATISTICS uses
BROWSE ACCESS to scan the table, the results are approximate.
Retrieving statistics from catalog tables
To see current statistics, use the SELECT statement to retrieve the information from
the catalog tables. For example, the second-highest value of a column is stored in
the COLUMNS table. The STATISTICSTIME column of the BASETABS table
contains the time that statistics for the table were last updated, stored as a timestamp
in Greenwich mean time.
See CATALOGS Table
on page C-9 or the entry for a specific catalog table for more
information about the information stored in the catalog.
Examples—UPDATE STATISTICS
The following statement updates all statistics for a table named PARTLOC on the
current default volume and subvolume without invalidating the associated programs:
UPDATE ALL STATISTICS FOR TABLE PARTLOC NO RECOMPILE;
The following statement updates statistics for columns in the primary key or in
indexes for a table named STUDENTS, directing SQL to calculate the statistics
based on the contents of the first 300 blocks in each partition:
UPDATE STATISTICS FOR TABLE STUDENTS SAMPLE 300 BLOCKS;
UPGRADE CATALOG Command
UPGRADE CATALOG is an SQLCI utility command that converts catalogs to a newer
version so the catalogs can register objects associated with a newer version of NonStop
SQL/MP software.
UPGRADE CATALOG[S] [ catalogs ] [ TO version ] ;