mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-5177: ha_partition and innodb index intersection produce fewer rows (MySQL Bug#70703)
(This is attempt at fix #2) (re-commit with fixed typo) - Moved the testcase from partition_test to partition_innodb.test where it can really work. - Made ordered index scans over ha_partition tables to satisfy ROR property for the case where underlying table uses extended keys.
This commit is contained in:
@ -716,5 +716,52 @@ GROUP BY 1, 2, 3;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-5177: ha_partition and innodb index intersection produce fewer rows (MySQL Bug#70703)
|
||||
--echo #
|
||||
create table t1 (
|
||||
a int not null,
|
||||
b int not null,
|
||||
pk int not null,
|
||||
primary key (pk),
|
||||
key(a),
|
||||
key(b)
|
||||
) engine=innodb partition by hash(pk) partitions 10;
|
||||
|
||||
insert into t1 values (1,2,4); # both
|
||||
insert into t1 values (1,0,17); # left
|
||||
insert into t1 values (1,2,25); # both
|
||||
|
||||
insert into t1 values (10,20,122);
|
||||
insert into t1 values (10,20,123);
|
||||
|
||||
# Now, fill in some data so that the optimizer choses index_merge
|
||||
create table t2 (a int);
|
||||
insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
||||
insert into t1 select 1,2, 200 + A.a + 10*B.a + 100*C.a from t2 A, t2 B, t2 C;
|
||||
|
||||
insert into t1 select 10+A.a + 10*B.a + 100*C.a + 1000*D.a,
|
||||
10+A.a + 10*B.a + 100*C.a + 1000*D.a,
|
||||
2000 + A.a + 10*B.a + 100*C.a + 1000*D.a
|
||||
from t2 A, t2 B, t2 C ,t2 D;
|
||||
|
||||
# This should show index_merge, using intersect
|
||||
--replace_column 9 #
|
||||
explain select * from t1 where a=1 and b=2 and pk between 1 and 999999 ;
|
||||
# 794 rows in output
|
||||
create temporary table t3 as
|
||||
select * from t1 where a=1 and b=2 and pk between 1 and 999 ;
|
||||
select count(*) from t3;
|
||||
drop table t3;
|
||||
|
||||
# 802 rows in output
|
||||
create temporary table t3 as
|
||||
select * from t1 ignore index(a,b) where a=1 and b=2 and pk between 1 and 999 ;
|
||||
select count(*) from t3;
|
||||
drop table t3;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
|
||||
set global default_storage_engine=default;
|
||||
|
Reference in New Issue
Block a user