diff options
author | Igor Babaev <igor@askmonty.org> | 2013-04-20 02:16:55 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2013-04-20 02:16:55 -0700 |
commit | 09a1f410cb2e014156f9d6dee87798ab5b28042b (patch) | |
tree | 33f3bb7992ebb53230cf544e7390d692866b7fee /mysql-test/t/selectivity.test | |
parent | 9441e536535af3e71aaa81801645ab42bd07e89f (diff) | |
download | mariadb-git-09a1f410cb2e014156f9d6dee87798ab5b28042b.tar.gz |
Fixed bug mdev-4406.
This bug in the code of get_column_range_cardinality() could lead to
wrong estimates of number of records in ranges for non-nullable columns.
Diffstat (limited to 'mysql-test/t/selectivity.test')
-rw-r--r-- | mysql-test/t/selectivity.test | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test index 8bde4718fdd..47f62365816 100644 --- a/mysql-test/t/selectivity.test +++ b/mysql-test/t/selectivity.test @@ -676,5 +676,36 @@ DROP TABLE t1,t2; set use_stat_tables=@save_use_stat_tables; +--echo # +--echo # Bug mdev-4406: range condition for non-nullable column +--echo # when optimizer_use_condition_selectivity=3 +--echo # + +create table t1 (a int not null); +insert into t1 values + (7), (6), (4), (9), (1), (5), (2), (1), (3), (8); + +set use_stat_tables='preferably'; + +analyze table t1; +flush table t1; + +set optimizer_use_condition_selectivity=3; + +select count(*) from t1 where a between 5 and 7; +explain extended select * from t1 where a between 5 and 7; + +alter table t1 change column a a int; +analyze table t1; +flush table t1; + +explain extended select * from t1 where a between 5 and 7; + +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; + +drop table t1; + +set use_stat_tables=@save_use_stat_tables; + set use_stat_tables=@save_use_stat_tables; |