15.15.5.2. Implementing the records_in_range Function
The
records_in_range()
function is called by the optimizer to assist in choosing
which index on a table to use for a query or join. It is
defined as follows:
ha_rows ha_foo::records_in_range(uint inx, key_range *min_key, key_range *max_key)
The inx parameter is the index to be
checked. The *min_key parameter is the low
end of the range while the *max_key
parameter is the high end of the range.
min_key.flag can have one of the following
values:
max_key.flag can have one of the following
values:
The following return values are allowed:
0 - There are no matching keys in the
given range
number > 0 - There is approximately
number matching rows in the
range
HA_POS_ERROR - Something is wrong with
the index tree
When calculating values, speed is more important than
accuracy.