A SAMPLE definition defines the number of rows in a table that are to be used when statistics are updated.
Syntax
<sample_definition> ::= SAMPLE <unsigned_integer> ROWS
| SAMPLE <unsigned_integer> PERCENT
Explanation
The database system manages statistics for each base table. These statistics are used to determine the best strategy for executing an SQL statement. The statistics are stored in the catalog by the
UPDATE STATISTICS statement.If a SAMPLE definition is specified in an UPDATE STATISTICS statement, it specifies the number of rows in the table that are to be used to calculate the statistics.
If a SAMPLE definition is not specified in an UPDATE STATISTICS statement and if it is not mandatory that all of the rows in the table be used to calculate the statistics, the database system uses the appropriate SAMPLE definition of the CREATE TABLE or ALTER TABLE statement.
The number of rows for which the UPDATE STATISTICS statement is to be executed can be defined by specifying a numeric or percentage value.
SQL statements in which the SAMPLE definition can be used
CREATE TABLE statement ALTER TABLE statement UPDATE STATISTICS statement