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_class.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_class.h')
-rw-r--r-- | sql/sql_class.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index e468e628e61..f95b95dc9a1 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -720,6 +720,7 @@ typedef struct system_variables ulong net_retry_count; ulong net_wait_timeout; ulong net_write_timeout; + ulong optimizer_extra_pruning_depth; ulong optimizer_prune_level; ulong optimizer_search_depth; ulong optimizer_selectivity_sampling_limit; |