summaryrefslogtreecommitdiff
path: root/mysql-test/main/range_vs_index_merge.test
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2022-10-04 16:16:06 +0300
committerMonty <monty@mariadb.org>2022-12-20 23:11:28 +0200
commit95bec99dc43d704ab530e879b05535be7a666070 (patch)
tree9b4752ff535dac0ccaff15778f87aa4480809be0 /mysql-test/main/range_vs_index_merge.test
parent891e207aebcefc357f48ae979db79ce029996269 (diff)
downloadmariadb-git-95bec99dc43d704ab530e879b05535be7a666070.tar.gz
Added test cases for preceding test
This includes all test changes from "Changing all cost calculation to be given in milliseconds" and forwards. Some of the things that caused changes in the result files: - As part of fixing tests, I added 'echo' to some comments to be able to easier find out where things where wrong. - MATERIALIZED has now a higher cost compared to X than before. Because of this some MATERIALIZED types have changed to DEPENDEND SUBQUERY. - Some test cases that required MATERIALIZED to repeat a bug was changed by adding more rows to force MATERIALIZED to happen. - 'Filtered' in SHOW EXPLAIN has in many case changed from 100.00 to something smaller. This is because now filtered also takes into account the smallest possible ref access and filters, even if they where not used. Another reason for 'Filtered' being smaller is that we now also take into account implicit filtering done for subqueries using FIRSTMATCH. (main.subselect_no_exists_to_in) This is caluculated in best_access_path() and stored in records_out. - Table orders has changed because more accurate costs. - 'index' and 'ALL' for small tables has changed to use 'range' or 'ref' because of optimizer_scan_setup_cost. - index can be changed to 'range' as 'range' optimizer assumes we don't have to read the blocks from disk that range optimizer has already read. This can be confusing in the case where there is no obvious where clause but instead there is a hidden 'key_column > NULL' added by the optimizer. (main.subselect_no_exists_to_in) - Scan on primary clustered key does not report 'Using Index' anymore (It's a table scan, not an index scan). - For derived tables, the number of rows is now 100 instead of 2, which can be seen in EXPLAIN. - More tests have "Using index for group by" as the cost of this optimization is now more correct (lower). - A primary key could be preferred for a normal key, even if it would access more rows, as it's faster to do 1 lokoup and 3 'index_next' on a clustered primary key than one lookup trough a secondary. (main.stat_tables_innodb) Notes: - There was a 4.7% more calls to best_extension_by_limited_search() in the main.greedy_optimizer test. However examining the test results it looked that the plans where slightly better (eq_ref where more chained together) so I assume this is ok. - I have verified a few test cases where there was notable/unexpected changes in the plan and in all cases the new optimizer plans where faster. (main.greedy_optimizer and some others)
Diffstat (limited to 'mysql-test/main/range_vs_index_merge.test')
-rw-r--r--mysql-test/main/range_vs_index_merge.test14
1 files changed, 8 insertions, 6 deletions
diff --git a/mysql-test/main/range_vs_index_merge.test b/mysql-test/main/range_vs_index_merge.test
index 6517beab0be..14d75b88bfa 100644
--- a/mysql-test/main/range_vs_index_merge.test
+++ b/mysql-test/main/range_vs_index_merge.test
@@ -714,6 +714,7 @@ SELECT * FROM City
ORDER BY Population LIMIT 5;
FLUSH STATUS;
+--sorted_result
SELECT * FROM City
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
AND (Population >= 100000 AND Population < 120000)
@@ -1174,9 +1175,9 @@ SELECT * FROM t1,t2,t3
DROP TABLE t1,t2,t3;
-#
-# LP bug #823301: index merge sort union with possible index scan
-#
+--echo #
+--echo # LP bug #823301: index merge sort union with possible index scan
+--echo #
CREATE TABLE t1 (
a int, b int, c int, d int,
@@ -1192,12 +1193,14 @@ SET SESSION optimizer_switch='index_merge_sort_union=off';
EXPLAIN
SELECT * FROM t1
WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7;
+--sorted_result
SELECT * FROM t1
WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7;
SET SESSION optimizer_switch='index_merge_sort_union=on';
EXPLAIN
SELECT * FROM t1
WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7;
+--sorted_result
SELECT * FROM t1
WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7;
SET SESSION optimizer_switch=DEFAULT;
@@ -1320,12 +1323,11 @@ where
Country='NOR' AND Name IN ('Oslo', 'Bergen') OR
Country='ITA' AND Name IN ('Napoli', 'Venezia');
-eval $q;
eval explain $q;
-
+--sorted_result
+eval $q;
DROP DATABASE world;
#the following command must be the last one in the file
set session optimizer_switch='index_merge_sort_intersection=default';
-