MDEV-30088 Assertion `cond_selectivity <= 1.0' failed in get_range_limit_read_cost

Fixed cost calculation for MERGE tables with 0 tables
This commit is contained in:
Monty 2022-12-27 16:39:58 +02:00
commit 76d2a77d52
3 changed files with 28 additions and 1 deletions

View file

@ -361,7 +361,8 @@ IO_AND_CPU_COST ha_myisammrg::keyread_time(uint index, ulong ranges,
cost.cpu*= file->tables;
}
/* Add the cost of having to do a key lookup in all trees */
cost.cpu+= (file->tables-1) * (ranges * KEY_LOOKUP_COST);
if (file->tables)
cost.cpu+= (file->tables-1) * (ranges * KEY_LOOKUP_COST);
return cost;
}