diff options
author | Sergei Petrunia <sergey@mariadb.com> | 2022-07-19 14:13:17 +0300 |
---|---|---|
committer | Sergei Petrunia <sergey@mariadb.com> | 2022-07-19 15:19:54 +0300 |
commit | ac3b3807cc9b21e23e65b1a70c7dcda1f45a3c57 (patch) | |
tree | 7ee8b4cb3c71d3bb5c0f318cc62c9ce4e735bf41 /sql/sql_select.h | |
parent | ec4e5900d0ae36fe2bc639d8ce3174b951cfb689 (diff) | |
download | mariadb-git-bb-10.10-mdev28929-v4.tar.gz |
MDEV-28929: Plan selection takes forever with MDEV-28852 ...bb-10.10-spetrunia2bb-10.10-mdev28929-v4
Part #2: Extend heuristic pruning to use multiple tables as the
"Model tables".
Before the patch, heuristic pruning uses only one "Model table":
The table which had the best cost AND record became the "Model table".
After that, if a table's cost and record were both worse than
those of the Model Table, the table would be pruned away.
This didn't work well when the first table (the optimizer sorts them
by record_count) had low record_count but relatively high cost: nothing
could be pruned afterwards.
The patch adds the two additional "Model tables": one with the least
cost and the other with the least record_count.
(In both cases, a table can be pruned away if BOTH its cost and
record_count are worse than those of a Model table)
The new pruning is active when the number of tables to consider for
the prefix is higher than @@optimizer_extra_pruning_depth.
One can see the new pruning in the Optimizer Trace as
- "pruned_by_heuristic":"min_record_count", or
- "pruned_by_heuristic":"min_read_time".
Old heuristic pruning shows as "pruned_by_heuristic":1.
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r-- | sql/sql_select.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h index 46a359c746f..e7c8b3527f6 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1329,6 +1329,13 @@ public: */ table_map cur_sj_inner_tables; + /* A copy of thd->variables.optimizer_prune_level */ + uint prune_level; + /* + If true, do extra heuristic pruning (enabled based on + optimizer_extra_pruning_depth) + */ + bool extra_heuristic_pruning; #ifndef DBUG_OFF void dbug_verify_sj_inner_tables(uint n_positions) const; #endif |