The mi_istats_set2lval() accessor function
The mi_istats_set2lval() function stores the second-largest index-key value in the statistics descriptor.
Syntax
void mi_istats_set2lval(MI_AM_ISTATS_DESC *istatsDesc,
void *2lval)
- istatsDesc
- Points to the statistics descriptor.
- 2lval
- Points to the second-largest key value in the index.
Usage
To determine the maximum value for an index key while it evaluates a query plan, the optimizer looks at the colmax value for the key column in the syscolumns system catalog table. The colmax column holds a 4-byte integer that represents the second-largest key value in the index. The optimizer assesses the second-largest key value to avoid the distortion that an excessive value can cause to the data distribution.
The am_stats purpose function can provide the second-largest value for each key. After storing the value in memory, pass it by reference with the mi_istats_set2lval() function. The database server places the first four bytes that begin at address 2lval as an integer value in the colmax column.
Return values
None