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

BUG#670417: Diverging results in maria-5.3-mwl128-dsmrr-cpk with join buffer, attempt 4

- Disable identical key handling optimization when
  IndexConditionPushdown is used
This commit is contained in:
Sergey Petrunya
2010-11-08 20:37:01 +03:00
parent 197c99427d
commit 0fb342ba56
4 changed files with 138 additions and 1 deletions

View File

@ -462,3 +462,48 @@ 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;

View File

@ -169,3 +169,52 @@ FROM t1
WHERE `key1` LIKE CONCAT( LEFT( '1' , 7 ) , '%' )
ORDER BY col1 LIMIT 7;
drop table t0, t1, t2;
--echo #
--echo # BUG#670417: Diverging results in maria-5.3-mwl128-dsmrr-cpk with join buffer (incremental, BKA join)
--echo #
set @save_join_cache_level = @@join_cache_level;
set join_cache_level = 6;
set @save_join_buffer_size=@@join_buffer_size;
--disable_warnings
set join_buffer_size = 136;
--enable_warnings
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;
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;
set join_cache_level= @save_join_cache_level;
set join_buffer_size= @save_join_buffer_size;
drop table t1;