summaryrefslogtreecommitdiff
path: root/mysql-test/main/statistics_json.test
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2021-10-22 19:43:19 +0300
committerSergei Petrunia <psergey@askmonty.org>2022-01-19 18:10:11 +0300
commit05877df472fa95cab763dfb1299e81681a12da73 (patch)
tree00753389e2ddeb3931cb3fdb605b2c92064373b1 /mysql-test/main/statistics_json.test
parentf3f78bed8530e1e858d5ed87054f2ac672760824 (diff)
downloadmariadb-git-05877df472fa95cab763dfb1299e81681a12da73.tar.gz
MDEV-26849: JSON Histograms: point selectivity estimates are off
.. for non-existent values. Handle this special case.
Diffstat (limited to 'mysql-test/main/statistics_json.test')
-rw-r--r--mysql-test/main/statistics_json.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/main/statistics_json.test b/mysql-test/main/statistics_json.test
index 352150e8497..e968c910f4b 100644
--- a/mysql-test/main/statistics_json.test
+++ b/mysql-test/main/statistics_json.test
@@ -295,3 +295,25 @@ select c from t1 where c > '1';
drop table t1;
+--echo #
+--echo # MDEV-26849: JSON Histograms: point selectivity estimates are off for non-existent values
+--echo #
+--echo #
+
+create table t0(a int);
+insert into t0 (a) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1(a int);
+insert into t1 select 100*A.a from t0 A, t0 B, t0 C;
+select a, count(*) from t1 group by a order by a;
+set histogram_type=json_hb, histogram_size=default;
+analyze table t1 persistent for all;
+select * from mysql.column_stats where table_name='t1';
+analyze select * from t1 where a=0;
+analyze select * from t1 where a=50;
+analyze select * from t1 where a=70;
+analyze select * from t1 where a=100;
+analyze select * from t1 where a=150;
+analyze select * from t1 where a=200;
+
+drop table t0,t1;
+