mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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)
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
--source include/innodb_prefix_index_cluster_optimization.inc
|
||||
--source include/no_valgrind_without_big.inc
|
||||
--source include/have_sequence.inc
|
||||
|
||||
SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB';
|
||||
|
||||
@ -156,14 +157,14 @@ show status like 'handler_read%';
|
||||
--echo #
|
||||
|
||||
create table t0 (a int);
|
||||
insert into t0 values (1), (2), (3), (4), (5);
|
||||
insert into t0 select seq from seq_1_to_5;
|
||||
create index i_p_size on part(p_size);
|
||||
|
||||
explain
|
||||
select * from t0, part ignore index (primary)
|
||||
select straight_join * from t0, part ignore index (primary)
|
||||
where p_partkey=t0.a and p_size=1;
|
||||
|
||||
select * from t0, part ignore index (primary)
|
||||
select straight_join * from t0, part ignore index (primary)
|
||||
where p_partkey=t0.a and p_size=1;
|
||||
|
||||
drop table t0;
|
||||
@ -240,10 +241,11 @@ INSERT INTO t2 VALUES
|
||||
(15), (16), (17), (18), (19), (24);
|
||||
|
||||
EXPLAIN
|
||||
SELECT a FROM t1 AS t, t2
|
||||
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
|
||||
SELECT a FROM t1 AS t, t2
|
||||
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
|
||||
SELECT a FROM t1 AS t, t2 as t2_out
|
||||
WHERE t2_out.c = t.a AND t.b IN (SELECT b FROM t1, t2 WHERE b = t.b);
|
||||
SELECT a FROM t1 AS t, t2 as t2_out
|
||||
WHERE t2_out.c = t.a AND t.b IN (SELECT b FROM t1, t2 WHERE b = t.b);
|
||||
--source include/last_query_cost.inc
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
|
Reference in New Issue
Block a user