diff options
author | Monty <monty@mariadb.org> | 2020-02-28 12:59:30 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2020-03-27 03:58:32 +0200 |
commit | eb483c5181ab430877c135c16224284cfc517b3d (patch) | |
tree | 05fc0a6583a84b51c84e72b69191974c4d9ca8c8 /mysql-test/main/partition_mrr_innodb.result | |
parent | b3ab3105fdb34dae6c2d4270751bc0694c3d9df8 (diff) | |
download | mariadb-git-eb483c5181ab430877c135c16224284cfc517b3d.tar.gz |
Updated optimizer costs in multi_range_read_info_const() and sql_select.cc
- multi_range_read_info_const now uses the new records_in_range interface
- Added handler::avg_io_cost()
- Don't calculate avg_io_cost() in get_sweep_read_cost if avg_io_cost is
not 1.0. In this case we trust the avg_io_cost() from the handler.
- Changed test_quick_select to use TIME_FOR_COMPARE instead of
TIME_FOR_COMPARE_IDX to align this with the rest of the code.
- Fixed bug when using test_if_cheaper_ordering where we didn't use
keyread if index was changed
- Fixed a bug where we didn't use index only read when using order-by-index
- Added keyread_time() to HEAP.
The default keyread_time() was optimized for blocks and not suitable for
HEAP. The effect was the HEAP prefered table scans over ranges for btree
indexes.
- Fixed get_sweep_read_cost() for HEAP tables
- Ensure that range and ref have same cost for simple ranges
Added a small cost (MULTI_RANGE_READ_SETUP_COST) to ranges to ensure
we favior ref for range for simple queries.
- Fixed that matching_candidates_in_table() uses same number of records
as the rest of the optimizer
- Added avg_io_cost() to JT_EQ_REF cost. This helps calculate the cost for
HEAP and temporary tables better. A few tests changed because of this.
- heap::read_time() and heap::keyread_time() adjusted to not add +1.
This was to ensure that handler::keyread_time() doesn't give
higher cost for heap tables than for normal tables. One effect of
this is that heap and derived tables stored in heap will prefer
key access as this is now regarded as cheap.
- Changed cost for index read in sql_select.cc to match
multi_range_read_info_const(). All index cost calculation is now
done trough one function.
- 'ref' will now use quick_cost for keys if it exists. This is done
so that for '=' ranges, 'ref' is prefered over 'range'.
- scan_time() now takes avg_io_costs() into account
- get_delayed_table_estimates() uses block_size and avg_io_cost()
- Removed default argument to test_if_order_by_key(); simplifies code
Diffstat (limited to 'mysql-test/main/partition_mrr_innodb.result')
-rw-r--r-- | mysql-test/main/partition_mrr_innodb.result | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mysql-test/main/partition_mrr_innodb.result b/mysql-test/main/partition_mrr_innodb.result index fd6d0245fb2..8e34914a6e3 100644 --- a/mysql-test/main/partition_mrr_innodb.result +++ b/mysql-test/main/partition_mrr_innodb.result @@ -129,7 +129,7 @@ set join_cache_level=6; set optimizer_switch='mrr=on'; explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index idx idx 5 NULL 20 10.00 Using where; Using index +1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index 1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = `test`.`t2`.`a` - 1 @@ -146,7 +146,7 @@ tp a b c a 3 4 30 zzzyy 4 explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index idx idx 5 NULL 20 10.00 Using where; Using index +1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index 1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = `test`.`t2`.`a` - 1 @@ -163,7 +163,7 @@ tp a b c a 3 4 30 zzzyy 4 explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index idx idx 5 NULL 20 10.00 Using where; Using index +1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index 1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = 4 @@ -189,7 +189,7 @@ tp a b c a 2 4 40 xxzy 4 explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index idx idx 5 NULL 20 10.00 Using where; Using index +1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index 1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = 4 @@ -221,7 +221,7 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain extended select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index idx idx 5 NULL 23 17.39 Using where; Using index +1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index 1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c` from `test`.`t2` left join `test`.`t0` on(`test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` is null @@ -229,7 +229,7 @@ select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null; a tp a b c explain extended select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index idx idx 5 NULL 23 17.39 Using where; Using index +1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index 1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` is null |