1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge DS-MRR/CPK improvements into 5.3-main

This commit is contained in:
Sergey Petrunya
2010-12-13 13:42:40 +03:00
41 changed files with 3250 additions and 534 deletions

View File

@ -1,4 +1,4 @@
drop table if exists t1, t2, t3;
drop table if exists t0, t1, t2, t3;
set @mrr_buffer_size_save= @@mrr_buffer_size;
set mrr_buffer_size=79;
Warnings:
@ -170,6 +170,7 @@ c-1020=w filler
c-1021=w filler
c-1022=w filler
c-1023=w filler
drop table if exists t4;
create table t4 (a varchar(10), b int, c char(10), filler char(200),
key idx1 (a, b, c));
insert into t4 (filler) select concat('NULL-', 15-a) from t2 order by a limit 15;
@ -413,4 +414,97 @@ explain select * from t1 where a < 20;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 20 Using index condition; Using MRR
set optimizer_switch=@save_optimizer_switch;
#
# BUG#629684: Unreachable code in multi_range_read.cc in maria-5.3-dsmrr-cpk
#
delete from t0 where a > 2;
insert into t0 values (NULL),(NULL);
insert into t1 values (NULL, 1234), (NULL, 5678);
set @save_join_cache_level=@@join_cache_level;
set @@join_cache_level=6;
explain
select * from t0, t1 where t0.a<=>t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 5
1 SIMPLE t1 ref a a 5 test.t0.a 1 Using index condition(BKA); Using join buffer (flat, BKA join)
select * from t0, t1 where t0.a<=>t1.a;
a a b
0 0 0
1 1 1
2 2 2
NULL NULL 1234
NULL NULL 1234
NULL NULL 5678
NULL NULL 5678
set @@join_cache_level=@save_join_cache_level;
drop table t0, t1;
#
# BUG#625841: Assertion `!table || (!table->read_set || bitmap_is_set
# (table->read_set, field_index))' on REPLACE ... SELECT with MRR
#
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (
key1 varchar(10),
col1 char(255), col2 char(255),
col3 char(244), col4 char(255),
key(key1)
);
create table t2 like t1;
insert into t1
select
1000+A.a+100*B.a + 10*C.a,
'col1val', 'col2val',
'col3val', 'col4val'
from t0 A, t0 B, t0 C;
REPLACE INTO t2(col2,col3,col4)
SELECT col2,col3,col4
FROM t1
WHERE `key1` LIKE CONCAT( LEFT( '1' , 7 ) , '%' )
ORDER BY col1 LIMIT 7;
drop table t0, t1, t2;
#
# BUG#670417: Diverging results in maria-5.3-mwl128-dsmrr-cpk with join buffer (incremental, BKA join)
#
set @save_join_cache_level = @@join_cache_level;
set join_cache_level = 6;
set @save_join_buffer_size=@@join_buffer_size;
set join_buffer_size = 136;
CREATE TABLE t1 (
pk int(11) NOT NULL AUTO_INCREMENT,
col_int_key int(11) NOT NULL,
col_varchar_key varchar(1) NOT NULL,
col_varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY col_varchar_key (col_varchar_key,col_int_key)
);
INSERT INTO t1 VALUES
(10,8,'v','v'),(11,8,'f','f'), (12,5,'v','v'),
(13,8,'s','s'),(14,8,'a','a'),(15,6,'p','p'),
(16,7,'z','z'),(17,2,'a','a'),(18,5,'h','h'),
(19,7,'h','h'),(20,2,'v','v'),(21,9,'v','v'),
(22,142,'b','b'),(23,3,'y','y'),(24,0,'v','v'),
(25,3,'m','m'),(26,5,'z','z'),(27,9,'n','n'),
(28,1,'d','d'),(29,107,'a','a');
SELECT COUNT(*)
FROM
t1 AS table2, t1 AS table3
where
table3.col_varchar_key = table2.col_varchar_key AND
table3.col_varchar_key = table2.col_varchar_nokey AND
table3.pk<>0;
COUNT(*)
50
EXPLAIN SELECT COUNT(*)
FROM
t1 AS table2, t1 AS table3
where
table3.col_varchar_key = table2.col_varchar_key AND
table3.col_varchar_key = table2.col_varchar_nokey AND
table3.pk<>0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE table2 ALL col_varchar_key NULL NULL NULL 20 Using where
1 SIMPLE table3 ref PRIMARY,col_varchar_key col_varchar_key 3 test.table2.col_varchar_key 3 Using index condition(BKA); Using where; Using join buffer (flat, BKA join)
set join_cache_level= @save_join_cache_level;
set join_buffer_size= @save_join_buffer_size;
drop table t1;