pub struct JoinOrderSearch { /* private fields */ }Expand description
Performs join order optimization via exhaustive search
Implementations§
Source§impl JoinOrderSearch
impl JoinOrderSearch
Sourcepub fn from_analyzer(analyzer: &JoinOrderAnalyzer, database: &Database) -> Self
pub fn from_analyzer(analyzer: &JoinOrderAnalyzer, database: &Database) -> Self
Create a new join order search from an analyzer with real table statistics
Sourcepub fn from_analyzer_with_predicates(
analyzer: &JoinOrderAnalyzer,
database: &Database,
table_local_predicates: &HashMap<String, Vec<Expression>>,
alias_to_table: &HashMap<String, String>,
) -> Self
pub fn from_analyzer_with_predicates( analyzer: &JoinOrderAnalyzer, database: &Database, table_local_predicates: &HashMap<String, Vec<Expression>>, alias_to_table: &HashMap<String, String>, ) -> Self
Create a new join order search with WHERE clause selectivity applied
This version accounts for table-local predicates when estimating cardinalities, which helps choose better join orders for queries like TPC-H Q3 where filter predicates significantly reduce table sizes before joining.
§Parameters
alias_to_table: Maps table aliases (e.g., “n1”, “n2”) to actual table names (e.g., “nation”). This is critical for queries with self-joins (like TPC-H Q7 with two nation aliases) to correctly look up table cardinalities and statistics.
Sourcepub fn from_analyzer_with_aggregates(
analyzer: &JoinOrderAnalyzer,
database: &Database,
table_local_predicates: &HashMap<String, Vec<Expression>>,
alias_to_table: &HashMap<String, String>,
aggregate_analysis: AggregateAnalysis,
) -> Self
pub fn from_analyzer_with_aggregates( analyzer: &JoinOrderAnalyzer, database: &Database, table_local_predicates: &HashMap<String, Vec<Expression>>, alias_to_table: &HashMap<String, String>, aggregate_analysis: AggregateAnalysis, ) -> Self
Create a new join order search with aggregate-aware optimization
This version accepts aggregate analysis results and can adjust join order decisions based on GROUP BY/HAVING clauses. When HAVING filters are selective, the optimizer may prefer different join orders that enable early aggregation.
§Parameters
alias_to_table: Maps table aliases to actual table names for database lookups.
Sourcepub fn find_optimal_order(&self) -> Vec<String>
pub fn find_optimal_order(&self) -> Vec<String>
Find optimal join order by exploring search space
Returns list of table names in the order they should be joined.
When time-bounded search is enabled (default), uses parallel BFS for all multi-table queries with a configurable time budget. This allows optimization of large queries (9+ tables) while preventing excessive search time.
When time-bounded search is disabled, uses legacy behavior: parallel BFS for 3-6 table queries with highly connected join graphs, DFS for others.
Auto Trait Implementations§
impl Freeze for JoinOrderSearch
impl RefUnwindSafe for JoinOrderSearch
impl Send for JoinOrderSearch
impl Sync for JoinOrderSearch
impl Unpin for JoinOrderSearch
impl UnwindSafe for JoinOrderSearch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more