mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-26901: Estimation for filtered rows less precise ... #4
In Histogram_json_hb::point_selectivity(), do return selectivity of 0.0 when the histogram says so. The logic of "Do not return 0.0 estimate as it causes a multiply-by-zero meltdown in cost and cardinality calculations" is moved into records_in_column_ranges() where it is one *once* per column pair (as opposed to doing once per range, which can cause the error to add-up to large number when there are many ranges)
This commit is contained in:
@ -8264,3 +8264,23 @@ ANALYZE SELECT * FROM t1 WHERE f > '00:01:00';
|
||||
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 1000 1000.00 50.00 50.00 Using where
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-26901: Estimation for filtered rows less precise ... #4
|
||||
#
|
||||
create table t1 (f int);
|
||||
insert into t1 values
|
||||
(7),(5),(0),(5),(112),(9),(9),(7),(5),(9),
|
||||
(1),(7),(0),(6),(6),(2),(1),(6),(169),(7);
|
||||
select f from t1 where f in (77, 1, 144, 73, 14, 12);
|
||||
f
|
||||
1
|
||||
1
|
||||
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 f from t1 where f in (77, 1, 144, 73, 14, 12);
|
||||
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 20 20.00 10.00 10.00 Using where
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user