The am_stats purpose function
The database server calls am_stats to process an UPDATE STATISTICS statement.
Syntax
mi_integer am_stats(MI_AM_TABLE_DESC *tableDesc,
MI_AM_TSTATS_DESC *tstatsDesc);
- tableDesc
- Points to the table descriptor.
- tstatsDesc
- Points to the statistics descriptor.
Usage
To influence the am_stats sampling rate, an UPDATE STATISTICS statement might include an optional distribution-level keyword, low, medium, or high. If the UPDATE STATISTICS statement does not include one of these keywords, the default low distribution level applies.
Adjust the sampling rate in your version of the am_stats purpose function according to the distribution-level keyword that the user specifies in the UPDATE STATISTICS statement. To determine which keyword—LOW, MEDIUM, or HIGH—an UPDATE STATISTICS statement specifies, call the mi_tab_update_stat_mode() function.
The am_stats purpose function calls the various Virtual-Table Interface (VTI) accessor functions that set values in the statistics descriptor for the database server. The database server places the statistics descriptor results in the systables and syscolumns, system catalog tables. The am_stats function can also save any additional values in a location that am_scancost can access, such as a file in the extspace or a table in sbspace.
Return values
- MI_OK
- Indicates success.
- MI_ERROR
- Indicates failure.