diff options
author | sergefp@mysql.com <> | 2006-09-18 14:49:54 +0400 |
---|---|---|
committer | sergefp@mysql.com <> | 2006-09-18 14:49:54 +0400 |
commit | 13901802bcdc24094504e392b100a934174a11e3 (patch) | |
tree | c9ea167b6014b2b17aa24282d7a2f3a7b3a5f6f4 /mysql-test/t/range.test | |
parent | 94028c618f7f7df2736851b6f4faa131708016d9 (diff) | |
download | mariadb-git-13901802bcdc24094504e392b100a934174a11e3.tar.gz |
BUG#22393: Very wrong E(#rows(ref(const)) for key with skewed distribution
- Check if we have E(#rows) for 'range' access on the smaller interval
on the same index. If yes, adjust the estimate.
Diffstat (limited to 'mysql-test/t/range.test')
-rw-r--r-- | mysql-test/t/range.test | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 735d3f11359..bc260f71e6e 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -711,3 +711,30 @@ DROP TABLE t1; # End of 5.0 tests + +# BUG#22393 fix: Adjust 'ref' estimate if we have 'range' estimate for +# a smaller scan interval +create table t1 (a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t2 (a int, b int, filler char(100)); +insert into t2 select A.a + 10 * (B.a + 10 * C.a), 10, 'filler' from t1 A, +t1 B, t1 C where A.a < 5; + +insert into t2 select 1000, b, 'filler' from t2; +alter table t2 add index (a,b); +# t2 values +# ( 1 , 10, 'filler') +# ( 2 , 10, 'filler') +# ( 3 , 10, 'filler') +# (... , 10, 'filler') +# ... +# (1000, 10, 'filler') - 500 times + +# 500 rows, 1 row + +select 'In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)' Z; +explain select * from t2 where a=1000 and b<11; + +drop table t1, t2; + |