mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +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:
@ -435,46 +435,48 @@ left join t16 on t15.o1 = t16.p1
|
||||
where t1.a10 = 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index
|
||||
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where
|
||||
1 SIMPLE t10 eq_ref PRIMARY PRIMARY 1 test.t1.a6 1
|
||||
1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index
|
||||
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index
|
||||
1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1
|
||||
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 Using where
|
||||
1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index
|
||||
1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where
|
||||
1 SIMPLE e2 eq_ref PRIMARY PRIMARY 4 test.t6.f1 1 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1
|
||||
1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1
|
||||
1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where
|
||||
1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where
|
||||
1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1
|
||||
1 SIMPLE t13 ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index
|
||||
1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index
|
||||
1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where
|
||||
1 SIMPLE m2 ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index
|
||||
1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where
|
||||
1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where
|
||||
1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index
|
||||
1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where
|
||||
1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where
|
||||
explain select * from v1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index
|
||||
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where
|
||||
1 SIMPLE t10 eq_ref PRIMARY PRIMARY 1 test.t1.a6 1
|
||||
1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index
|
||||
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index
|
||||
1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1
|
||||
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1
|
||||
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 Using where
|
||||
1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index
|
||||
1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where
|
||||
1 SIMPLE e2 eq_ref PRIMARY PRIMARY 4 test.t6.f1 1 Using where
|
||||
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1
|
||||
1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1
|
||||
1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where
|
||||
1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where
|
||||
1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1
|
||||
1 SIMPLE t13 ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index
|
||||
1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index
|
||||
1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where
|
||||
1 SIMPLE m2 ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index
|
||||
1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where
|
||||
1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where
|
||||
1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index
|
||||
1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where
|
||||
1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where
|
||||
drop view v1;
|
||||
drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
|
||||
|
Reference in New Issue
Block a user