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

Fix LP BUG#680058

Analysis:
The send_data method of the result sink class used to collect
data statistics about materialized subqueries incorrectly assumed
that duplicate rows are removed prior to calling send_data. As
a result the collected statistics was wrong, which resulted in
an incorrect maximal number of keys in the Ordered_key buffer.
  
Solution:
Try to insert each row into the materialized temp table before
collecting statistics, and if the insertion results in a duplicate
row, do not count the current row.
This commit is contained in:
unknown
2010-11-25 00:34:50 +02:00
parent ea94906c23
commit 0574bc894b
5 changed files with 45 additions and 7 deletions

View File

@ -48,3 +48,18 @@ select * from t1 where (a1, a2) not in (select a1, a2 from t1);
a1 a2
drop table t1;
set @@optimizer_switch=@save_optimizer_switch;
#
# LP BUG#680058 void Ordered_key::add_key(rownum_t):
# Assertion `key_buff_elements && cur_key_idx < key_buff_elements' failed
#
create table t1 (f1 char(1), f2 char(1));
insert into t1 values ('t', '0'), ('0', 't');
create table t2 (f3 char(1), f4 char(1));
insert into t2 values ('t', NULL), ('t', NULL), ('d', 'y');
set @save_optimizer_switch=@@optimizer_switch;
SET @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,semijoin=off';
select * from t1 where (f1, f2) not in (select * from t2);
f1 f2
0 t
set @@optimizer_switch=@save_optimizer_switch;
drop table t1, t2;

View File

@ -54,3 +54,19 @@ explain select * from t1 where (a1, a2) not in (select a1, a2 from t1);
select * from t1 where (a1, a2) not in (select a1, a2 from t1);
drop table t1;
set @@optimizer_switch=@save_optimizer_switch;
--echo #
--echo # LP BUG#680058 void Ordered_key::add_key(rownum_t):
--echo # Assertion `key_buff_elements && cur_key_idx < key_buff_elements' failed
--echo #
create table t1 (f1 char(1), f2 char(1));
insert into t1 values ('t', '0'), ('0', 't');
create table t2 (f3 char(1), f4 char(1));
insert into t2 values ('t', NULL), ('t', NULL), ('d', 'y');
set @save_optimizer_switch=@@optimizer_switch;
SET @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,semijoin=off';
select * from t1 where (f1, f2) not in (select * from t2);
set @@optimizer_switch=@save_optimizer_switch;
drop table t1, t2;