summaryrefslogtreecommitdiff
path: root/mysql-test/main/mysql_not_windows.test
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-11-09 14:45:53 +0200
committerSergei Krivonos <sergeikrivonos@gmail.com>2021-12-13 15:32:34 +0200
commit1ebeab3d422541e3c7141784406fab3836e3fae6 (patch)
tree254c7547f20ff1816ec4616321faaf79cba5f23f /mysql-test/main/mysql_not_windows.test
parentb260ff88534df8f75d249e6ae9bbbfa1bcc4b7d9 (diff)
downloadmariadb-git-1ebeab3d422541e3c7141784406fab3836e3fae6.tar.gz
Another fixup, to be combined with the previous commits
Fixed a lot of inconsistencies in optimizer cost calculation. The main objective was get cost calculation as similar (and accurate) as possible to make different plans more comparable. - Replaced constant 2.0 with new define TABLE_SCAN_SETUP_COST. - Added RECORD_COPY_COST, the cost of finding the next row and copying it to record for table scans. - Added INDEX_COPY_COST, the cost of finding the next key and copying it to record for index scans. - Added INDEX_NEXT_FIND_COST, the cost of finding the next index entry and checking it against filter. - Some scan cost estimates did not take into account TIME_FOR_COMPARE. Now all scan costs takes this into account. (main.show_explain) - Fixed that we don't calculate TIME_FOR_COMPARE twice for some plans, like in optimize_straight_join() and greedy_search() - JOIN_TAB::scan_time() did not take into account index only scans, which produced a wrong cost when index scan was used. Fixed by adding support for covering keys. Cached also the calculated values to avoid future calls during optimization phase. - Fixed that most index cost calculation are done the same way and more close to 'range' calculations. The effects of this change are: - Cost of index scan is now lower than before, which causes some tests result to change. (innodb.innodb, main.show_explain) - Fixed the EQ_REF takes into account clustered and covered keys. - Ensured that index_scan_cost() == range(scan_of_all_rows_in_table_using_one_range) + MULTI_RANGE_READ_INFO_CONST. One effect of this is that if there is choice of doing a full index scan and a range-index scan over almost the whole table then index scan will be preferred (no range-read setup cost). - Rowid filter setup cost and filter compare cost now takes into account fetching and checking the rowid (INDEX_NEXT_FIND_COST). (main.partition_pruning heap.heap_btree main.log_state) - Introduced ha_scan_time() that takes into account the CPU cost of finding the next row and copying the row from the engine to 'record'. This causes costs of table scan to slightly increase and some test to changed their plan from ALL to RANGE or ALL to ref. (innodb.innodb_mysql, main.select_pkeycache) - Introduced ha_scan_and_compare_time() to is like ha_scan_time() but also adds the cost of checking the where clause (TIME_FOR_COMPARE). - Cost of index scan was too low before compared to anything else. - Introduced ha_keyread_time(rows) that takes into account finding the next row and copying the key value to 'record' (INDEX_COPY_COST). - Introduced ha_key_scan_time() for calculating an index scan over all rows. - Added IDX_LOOKUP_COST to keyread_time() as a startup cost. - Added index_only_fetch_cost() as a convenience function to OPT_RANGE. - keyread_time() cost is slightly reduced to prefer shorter keys. - All of the above caused some index_merge combinations to be rejected because of cost (main.index_intersect) - Added checking of the WHERE clause of the accepted rows to ROR costs in get_best_ror_intersect() - Fixed bug in get_best_ror_intersect() where 'min_cost' was not updated, and the cost we compared with was not the one that was used. - Removed '- 0.001' from 'join->best_read' and optimize_straight_join() to ensure that the 'Last_query_cost' status variable contains the same value as the one that was calculated by the optimizer. - Extend get_range_limit_read_cost() to take into considering cost_for_index_read() if there where no quick keys. This will reduce the computed cost for ORDER BY with LIMIT in some cases. (main.innodb_ext_key) - Added INDEX_NEXT_FIND_COST to Range_rowid_filter_cost_info::lookup_cost to account of the time to find and check the next key value against the container - Changed 'JOIN_TAB:::scan_time() to take into consideration clustered and covered keys. The values are now cached and we only have to call this function once. Other calls are changed to use the cached values. Function renamed to JOIN_TAB::estimate_scan_time(). Other things: - Added some 'if (thd->trace_started())' to speed up code - Removed not used function Cost_estimate::is_zero() - Simplified testing of HA_POS_ERROR in get_best_ror_intersect(). (No cost changes)
Diffstat (limited to 'mysql-test/main/mysql_not_windows.test')
0 files changed, 0 insertions, 0 deletions