Manually collect basic statistics
For more information about basic statistics, see Gather statistics for CBO.Syntax
Parameter description
-
Collection type
- FULL: indicates full collection.
- SAMPLE: indicates sampled collection.
- If no collection type is specified, full collection is used by default.
-
col_name: columns from which to collect statistics. Separate multiple columns with commas (,). If this parameter is not specified, the entire table is collected. - [WITH SYNC | ASYNC MODE]: whether to run the manual collection task in synchronous or asynchronous mode. Synchronous collection is used by default if you do not specify this parameter.
-
PROPERTIES: custom parameters. IfPROPERTIESis not specified, the default settings in thefe.conffile are used. The properties that are actually used can be viewed via thePropertiescolumn in the output of SHOW ANALYZE STATUS.
Examples
Example 1: Manual full collectionManually collect histograms
For more information about histograms, see Gather statistics for CBO.Syntax
Parameter description
-
col_name: columns from which to collect statistics. Separate multiple columns with commas (,). If this parameter is not specified, the entire table is collected. This parameter is required for histograms. - [WITH SYNC | ASYNC MODE]: whether to run the manual collection task in synchronous or asynchronous mode. Synchronous collection is used by default if you do not specify this parameter.
-
WITH N BUCKETS:Nis the number of buckets for histogram collection. If not specified, the default value infe.confis used. -
PROPERTIES: custom parameters. If
PROPERTIESis not specified, the default settings infe.confare used. The properties that are actually used can be viewed via thePropertiescolumn in the output of SHOW ANALYZE STATUS.
The number of rows to collect for a histogram is controlled by multiple parameters. It is the larger value between
statistic_sample_collect_rows and table row count * histogram_sample_ratio. The number cannot exceed the value specified by histogram_max_sample_row_count. If the value is exceeded, histogram_max_sample_row_count takes precedence.