Comment 8 for bug 1005898

Revision history for this message
Sergey Petrunia (sergefp) wrote :

The problem seems to be the mismatch between range and index_merge costs:

Range access costs
- are calculated in handler::multi_range_read_info_const(), the formula is roughly

     handler::read_time() + #rows / TIME_FOR_COMPARE

index_merge costs:
- are calculated in opt_range.cc.
- for a 2-way intersection over a MyISAM table the formula is roughly:

  handler->keyread_time(index1, ...) + handler->keyread_time(index2, ...) + get_sweep_read_cost(...)

note that the formula only includes index costs, #rows / TIME_FOR_COMPARE was not added.