Guilhem Bichot wrote:
>> Patch "remove_floor"
>> =============
>>
>> * I agree that to remove the floor() call should be fine since this is
>> anyway just a cost estimate. Still, the crash that this introduced
>> needs to be investigated.
>>
>> * An alternative to your proposal that both would preserve the "round
>> down" effect and possibly also could save a cycle or two could be to
>> change the expression to use integer arithmetic. Something like this:
>>
>> tmp*= (1.0 + (cache_record_length(join,idx) *
>> static_cast<uint64_t>(record_count) /
>> thd->variables.join_buff_size));
>>
>> An added benefit is that the subselect3 test passes :-)
>
> I had tried this too, but later abandoned it. I feared that uint64's
> range (1E10) is so much smaller than double's range (1E308) that there
> would be overflow in some calculations. And also it was slower than just
> removing floor().
>
Value range of uint64 will definitely be large enough here. The multiplication
is calculating the cache size, and that will always be contained in a 64-bit
integer. What is worse is the poor performance...
Roy