| 10582 | */ |
| 10583 | |
| 10584 | static uint |
| 10585 | determine_search_depth(JOIN *join) |
| 10586 | { |
| 10587 | uint table_count= join->table_count - join->const_tables; |
| 10588 | uint search_depth; |
| 10589 | /* TODO: this value should be determined dynamically, based on statistics: */ |
| 10590 | uint max_tables_for_exhaustive_opt= 7; |
| 10591 | |
| 10592 | if (table_count <= max_tables_for_exhaustive_opt) |
| 10593 | search_depth= table_count+1; // use exhaustive for small number of tables |
| 10594 | else |
| 10595 | /* |
| 10596 | TODO: this value could be determined by some mapping of the form: |
| 10597 | depth : table_count -> [max_tables_for_exhaustive_opt..MAX_EXHAUSTIVE] |
| 10598 | */ |
| 10599 | search_depth= max_tables_for_exhaustive_opt; // use greedy search |
| 10600 | |
| 10601 | return search_depth; |
| 10602 | } |
| 10603 | |
| 10604 | |
| 10605 | /** |