summaryrefslogtreecommitdiff
path: root/mysql-test/main/selectivity.test
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-02-22 21:25:16 +0100
committerSergei Golubchik <serg@mariadb.org>2021-02-22 22:42:27 +0100
commit0ab1e3914c78e4a82a8e4502b58b20e5598727ab (patch)
tree403a06406bd6998e588cb51a0f058cfa668e96da /mysql-test/main/selectivity.test
parentca126d96f5175ba03c32ea79774075d6d42c98cb (diff)
parent3c021485c913828b83510967c1ff277011a9d59a (diff)
downloadmariadb-git-0ab1e3914c78e4a82a8e4502b58b20e5598727ab.tar.gz
Merge branch '10.2' into 10.3
Diffstat (limited to 'mysql-test/main/selectivity.test')
-rw-r--r--mysql-test/main/selectivity.test45
1 files changed, 45 insertions, 0 deletions
diff --git a/mysql-test/main/selectivity.test b/mysql-test/main/selectivity.test
index a31573edb8e..4d7dcdc9781 100644
--- a/mysql-test/main/selectivity.test
+++ b/mysql-test/main/selectivity.test
@@ -1286,6 +1286,51 @@ drop table t1;
--echo # End of 10.1 tests
+--echo #
+--echo # MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect
+--echo #
+
+SET optimizer_use_condition_selectivity=4;
+SET histogram_size=255;
+CREATE TABLE t1 (a BIT(32), b INT);
+INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82);
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81;
+SELECT HEX(a), b from t1 where t1.a >= 81;
+
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set histogram_size=@save_histogram_size;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3
+--echo #
+
+CREATE TABLE t1(a int);
+INSERT INTO t1 values (1),(2),(2),(3),(4);
+SET optimizer_use_condition_selectivity=4;
+SET histogram_size= 255;
+
+set use_stat_tables='preferably';
+
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
+SET optimizer_use_condition_selectivity=3;
+
+--echo # filtered should show 25 %
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
+FLUSH TABLES;
+
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set histogram_size=@save_histogram_size;
+set use_stat_tables= @save_use_stat_tables;
+
+DROP TABLE t1;
+
+--echo # End of 10.2 tests
+
#
# Clean up
#