Commit 8c2faad
committed
MDEV-28929: Plan selection takes forever with MDEV-28852 ...
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.1 parent afadd58 commit 8c2faad
File tree
8 files changed
+112
-178
lines changed- mysql-test
- main
- suite/sys_vars/r
- sql
8 files changed
+112
-178
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
699 | 699 | | |
700 | 700 | | |
701 | 701 | | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
702 | 706 | | |
703 | 707 | | |
704 | 708 | | |
| |||
1662 | 1666 | | |
1663 | 1667 | | |
1664 | 1668 | | |
| 1669 | + | |
1665 | 1670 | | |
1666 | 1671 | | |
1667 | 1672 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6035 | 6035 | | |
6036 | 6036 | | |
6037 | 6037 | | |
6038 | | - | |
6039 | | - | |
6040 | | - | |
6041 | | - | |
6042 | | - | |
6043 | | - | |
6044 | | - | |
6045 | | - | |
6046 | | - | |
6047 | | - | |
6048 | | - | |
6049 | | - | |
6050 | | - | |
6051 | | - | |
6052 | | - | |
6053 | | - | |
6054 | | - | |
6055 | | - | |
6056 | | - | |
6057 | | - | |
6058 | | - | |
6059 | | - | |
6060 | | - | |
6061 | | - | |
6062 | | - | |
6063 | | - | |
6064 | | - | |
6065 | | - | |
6066 | | - | |
6067 | | - | |
6068 | | - | |
6069 | | - | |
6070 | | - | |
6071 | | - | |
6072 | | - | |
6073 | | - | |
6074 | | - | |
6075 | | - | |
6076 | | - | |
6077 | | - | |
6078 | | - | |
6079 | | - | |
6080 | | - | |
6081 | | - | |
6082 | | - | |
6083 | | - | |
6084 | | - | |
6085 | | - | |
6086 | | - | |
6087 | | - | |
6088 | | - | |
6089 | | - | |
6090 | | - | |
6091 | | - | |
6092 | | - | |
6093 | | - | |
6094 | | - | |
6095 | | - | |
6096 | | - | |
6097 | | - | |
6098 | | - | |
6099 | | - | |
6100 | | - | |
6101 | | - | |
6102 | | - | |
6103 | | - | |
6104 | | - | |
6105 | | - | |
6106 | | - | |
6107 | | - | |
6108 | | - | |
6109 | | - | |
6110 | | - | |
6111 | | - | |
6112 | | - | |
6113 | | - | |
6114 | | - | |
6115 | | - | |
6116 | | - | |
6117 | | - | |
| 6038 | + | |
6118 | 6039 | | |
6119 | 6040 | | |
6120 | 6041 | | |
| |||
6596 | 6517 | | |
6597 | 6518 | | |
6598 | 6519 | | |
6599 | | - | |
6600 | | - | |
6601 | | - | |
6602 | | - | |
6603 | | - | |
6604 | | - | |
6605 | | - | |
6606 | | - | |
6607 | | - | |
6608 | | - | |
6609 | | - | |
6610 | | - | |
6611 | | - | |
6612 | | - | |
6613 | | - | |
6614 | | - | |
6615 | | - | |
6616 | | - | |
6617 | | - | |
6618 | | - | |
6619 | | - | |
6620 | | - | |
6621 | | - | |
6622 | | - | |
6623 | | - | |
6624 | | - | |
6625 | | - | |
6626 | | - | |
6627 | | - | |
6628 | | - | |
6629 | | - | |
6630 | | - | |
6631 | | - | |
6632 | | - | |
6633 | | - | |
6634 | | - | |
6635 | | - | |
6636 | | - | |
6637 | | - | |
6638 | | - | |
6639 | | - | |
6640 | | - | |
6641 | | - | |
6642 | | - | |
6643 | | - | |
6644 | | - | |
6645 | | - | |
6646 | | - | |
6647 | | - | |
6648 | | - | |
6649 | | - | |
6650 | | - | |
6651 | | - | |
6652 | | - | |
6653 | | - | |
6654 | | - | |
6655 | | - | |
6656 | | - | |
6657 | | - | |
6658 | | - | |
6659 | | - | |
6660 | | - | |
6661 | | - | |
6662 | | - | |
6663 | | - | |
6664 | | - | |
6665 | | - | |
6666 | | - | |
6667 | | - | |
6668 | | - | |
6669 | | - | |
6670 | | - | |
6671 | | - | |
6672 | | - | |
6673 | | - | |
6674 | | - | |
6675 | | - | |
6676 | | - | |
6677 | | - | |
6678 | | - | |
| 6520 | + | |
6679 | 6521 | | |
6680 | 6522 | | |
6681 | 6523 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2252 | 2252 | | |
2253 | 2253 | | |
2254 | 2254 | | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
2255 | 2265 | | |
2256 | 2266 | | |
2257 | 2267 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2422 | 2422 | | |
2423 | 2423 | | |
2424 | 2424 | | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
2425 | 2435 | | |
2426 | 2436 | | |
2427 | 2437 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
720 | 720 | | |
721 | 721 | | |
722 | 722 | | |
| 723 | + | |
723 | 724 | | |
724 | 725 | | |
725 | 726 | | |
| |||
0 commit comments