mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-26750: Estimation for filtered rows is far off with JSON_HB histogram
Fix a bug in position_in_interval(). Do not overwrite one interval endpoint with another.
This commit is contained in:
@ -4243,12 +4243,12 @@ test t1_json a a-0 a-9 0.0000 3.0000 1.0000 10 JSON_HB {
|
||||
}
|
||||
explain extended select * from t1_json where a between 'a-3a' and 'zzzzzzzzz';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 50.00 Using where
|
||||
1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 58.71 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1_json`.`a` AS `a` from `test`.`t1_json` where `test`.`t1_json`.`a` between 'a-3a' and 'zzzzzzzzz'
|
||||
analyze select * from t1_json where a between 'a-3a' and 'zzzzzzzzz';
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 10.00 50.00 60.00 Using where
|
||||
1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 10.00 58.71 60.00 Using where
|
||||
explain extended select * from t1_json where a < 'b-1a';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 90.00 Using where
|
||||
@ -7280,7 +7280,7 @@ Percentage 0.0 99.9 47 JSON_HB {
|
||||
}
|
||||
analyze select * from Country use index () where Code between 'BBC' and 'GGG';
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE Country ALL NULL NULL NULL NULL 239 239.00 25.10 25.52 Using where
|
||||
1 SIMPLE Country ALL NULL NULL NULL NULL 239 239.00 24.58 25.52 Using where
|
||||
analyze select * from Country use index () where Code < 'BBC';
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE Country ALL NULL NULL NULL NULL 239 239.00 8.37 7.11 Using where
|
||||
@ -7510,3 +7510,23 @@ histogram
|
||||
]
|
||||
}
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-26750: Estimation for filtered rows is far off with JSON_HB histogram
|
||||
#
|
||||
create table t1 (c char(8));
|
||||
insert into t1 values ('1x');
|
||||
insert into t1 values ('1x');
|
||||
insert into t1 values ('1xx');
|
||||
insert into t1 values ('0xx');
|
||||
insert into t1 select * from t1;
|
||||
insert into t1 select * from t1;
|
||||
set histogram_type= JSON_HB;
|
||||
analyze table t1 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
analyze
|
||||
select c from t1 where c > '1';
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 75.00 75.00 Using where
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user