Commit 76d2a77d authored by Monty's avatar Monty

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

Fixed cost calculation for MERGE tables with 0 tables
parent 3fa99f0c
......@@ -3925,3 +3925,16 @@ drop table tm, t;
#
# End of 10.8 tests
#
#
# MDEV-30088 Assertion `cond_selectivity <= 1.0' failed in get_range_limit_read_cost
#
CREATE TABLE t1 (a TIMESTAMP, KEY(a)) ENGINE=MRG_MyISAM;
explain SELECT a, COUNT(*) FROM t1 WHERE a >= '2000-01-01 00:00:00' GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT a, COUNT(*) FROM t1 WHERE a >= '2000-01-01 00:00:00' GROUP BY a;
a COUNT(*)
DROP TABLE t1;
#
# End of 11.0 tests
#
......@@ -2886,3 +2886,16 @@ drop table tm, t;
--echo #
--echo # End of 10.8 tests
--echo #
--echo #
--echo # MDEV-30088 Assertion `cond_selectivity <= 1.0' failed in get_range_limit_read_cost
--echo #
CREATE TABLE t1 (a TIMESTAMP, KEY(a)) ENGINE=MRG_MyISAM;
explain SELECT a, COUNT(*) FROM t1 WHERE a >= '2000-01-01 00:00:00' GROUP BY a;
SELECT a, COUNT(*) FROM t1 WHERE a >= '2000-01-01 00:00:00' GROUP BY a;
DROP TABLE t1;
--echo #
--echo # End of 11.0 tests
--echo #
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment