summaryrefslogtreecommitdiff
path: root/mysql-test/main/opt_trace_security.result
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.9' into 10.10Oleksandr Byelkin2022-10-041-1/+1
|\
| * Merge branch '10.5' into 10.6Sergei Golubchik2022-10-021-1/+1
| |\
| | * Merge branch '10.4' into 10.5Sergei Golubchik2022-10-021-1/+1
| | |\
| | | * Merge branch '10.3' into 10.4Sergei Golubchik2022-10-011-1/+1
| | | |
* | | | Added EQ_REF chaining to the greedy_optimizerMonty2022-07-261-30/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-28073 Slow query performance in MariaDB when using many table The idea is to prefer and chain EQ_REF tables (tables that uses an unique key to find a row) when searching for the best table combination. This significantly reduces row combinations that has to be examined. This is optimization is enabled when setting optimizer_prune_level=2 (which is now default). Implementation: - optimizer_prune_level has a new level, 2, which enables EQ_REF optimization in addition to the pruning done by level 1. Level 2 is now default. - Added JOIN::eq_ref_tables that contains bits of tables that could use potentially use EQ_REF access in the query. This is calculated in sort_and_filter_keyuse() Under optimizer_prune_level=2: - When the greedy_optimizer notices that the preceding table was an EQ_REF table, it tries to add an EQ_REF table next. If an EQ_REF table exists, only this one will be considered at this level. We also collect all EQ_REF tables chained by the next levels and these are ignored on the starting level as we have already examined these. If no EQ_REF table exists, we continue as normal. This optimization speeds up the greedy_optimizer combination test with ~25% Other things: - I ported the changes in MySQL 5.7 to greedy_optimizer.test to MariaDB to be able to ensure we can handle all cases that MySQL can do. - I have run all tests with --mysqld=--optimizer_prune_level=1 to verify that there where no test changes.
* | | | Improve pruning in greedy_search by sorting tables during searchMonty2022-07-261-2/+10
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-28073 Slow query performance in MariaDB when using many tables The faster we can find a good query plan, the more options we have for finding and pruning (ignoring) bad plans. This patch adds sorting of plans to best_extension_by_limited_search(). The plans, from best_access_path() are sorted according to the numbers of found rows. This allows us to faster find 'good tables' and we are thus able to eliminate 'bad plans' faster. One side effect of this patch is that if two tables have equal cost, the table that which was used earlier in the query is preferred. This allows users to improve plans by reordering eq_ref tables in the order they would like them to be uses. Result changes caused by the patch: - Traces are different as now we print the cost for using tables before we start considering them in the plan. - Table order are changed for some plans. In most cases this is because the plans are equal and tables are in this case sorted according to their usage in the original query. - A few plans was changed as the optimizer was able to find a better plan (that was pruned by the original code). Other things: - Added a new statistic variable: "optimizer_join_prefixes_check_calls", which counts number of calls to best_extension_by_limited_search(). This can be used to check the prune efficiency in greedy_search(). - Added variable "JOIN_TAB::embedded_dependent" to be able to handle XX IN (SELECT..) in the greedy_optimizer. The idea is that we should prune a table if any of the tables in embedded_dependent is not yet read. - When using many tables in a query, there will be some additional memory usage as we need to pre-allocate table of table_count*table_count*sizeof(POSITION) objects (POSITION is 312 bytes for now) to hold the pre-calculated best_access_path() information. This memory usage is offset by the expected performance improvement when using many tables in a query. - Removed the code from an earlier patch to keep the table order in join->best_ref in the original order. This is not needed anymore as we are now sorting the tables for each best_extension_by_limited_search() call.
* | | MDEV-28073 Query performance degradation in newer MariaDB versions when ↵Monty2022-05-121-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | using many tables The issue was that best_extension_by_limited_search() had to go through too many plans with the same cost as there where many EQ_REF tables. Fixed by shortcutting EQ_REF (AND REF) when the result only contains one row. This got the optimization time down from hours to sub seconds. The only known downside with this patch is that in some cases a table with ref and 1 record may be used before on EQ_REF table. The faster optimzation phase should compensate for this.
* | | MDEV-23645: Optimizer trace: print conditions after ↵Sergei Petrunia2021-03-191-2/+0
|/ / | | | | | | | | | | substitute_for_best_equal_field Print the conditions for WHERE, HAVING, and ON.
* | Added more digits to JSON output of doubleMonty2020-04-191-8/+8
|/ | | | | | | sprintf() format of double changed from '%lg' to '%-.11lg' The change was to make it easier to read optimizer trace output with tables that has millions of records.
* MDEV-22014: Rowid Filtering is not displayed well in the optimizer traceSergei Petrunia2020-04-021-4/+2
| | | | | | - Print the rowid filters that are available for use with each table. - Make print_best_access_for_table() print which filter it has picked. - Make best_access_path() print the filter for considered ref accesses.
* MDEV-20444: More information regarding access of a table to be printed ↵Varun Gupta2019-09-111-4/+26
| | | | | | | | | inside the optimizer_trace Added: 1) estimated_join_cardinality 2) best_chosen_access_method for a table 3) best_join_order
* Optimizer trace: print cost and #rows of the join prefixSergei Petrunia2019-08-131-2/+6
| | | | | The names rows_for_plan and cost_for_plan follow MySQL Also added post-join-operation selectivity cost
* Minor cleanup in the optimizer trace code.Varun Gupta2019-02-181-14/+4
| | | | More test coverage added for the optimizer trace.
* MDEV-6111 Optimizer TraceVarun Gupta2019-02-131-0/+396
This task involves the implementation for the optimizer trace. This feature produces a trace for any SELECT/UPDATE/DELETE/, which contains information about decisions taken by the optimizer during the optimization phase (choice of table access method, various costs, transformations, etc). This feature would help to tell why some decisions were taken by the optimizer and why some were rejected. Trace is session-local, controlled by the @@optimizer_trace variable. To enable optimizer trace we need to write: set @@optimizer_trace variable= 'enabled=on'; To display the trace one can run: SELECT trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; This task also involves: MDEV-18489: Limit the memory used by the optimizer trace introduces a switch optimizer_trace_max_mem_size which limits the memory used by the optimizer trace. This was implemented by Sergei Petrunia.