The mi_istats_set2sval() accessor function

The mi_istats_set2sval() function stores the second-smallest index-key value in the statistics descriptor.

Syntax

void mi_istats_set2sval(MI_AM_ISTATS_DESC *istatsDesc,
   void *2sval)
istatsDesc
Points to the statistics descriptor.
2sval
Points to the second-smallest key value in the index.

Usage

To determine the minimum value for an index key while it evaluates a query plan, the optimizer looks at the colmin value for the key column in the syscolumns system catalog table. The colmin column holds a 4-byte integer that represents the second-smallest key value in the index. The optimizer assesses the second-smallest key value to avoid the distortion that an abnormally low 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_set2sval() function. The database server places the first four bytes that begin at address 2sval as an integer value in the colmin column.

Return values

None