The static join order optimizer should consider the swing in stakes when choosing between either the MIN or the MAX of the cardinality of two join dimensions in order to decide which join to schedule next. Historically it took the MAX, but there are counter examples to that decision such as LUBM Q2. Subsequently it was modified to take the MIN, but BSBM BI Q1 is a counter example for that.
1. Modify the static optimizer to consider the swing in stakes between the choice of MAX versus MIN. I believe that this boils down to something like "If an incorrect guess of MIN would cause us to suffer a very bad MAX, then choose based on the MAX to avoid paying that penalty."
2. Define a query hint for these three tie breaker behaviors. The query hint can be declared in ASTStaticJoinOptimizer for now on an Annotations interface. Query hints are string data, so you need to parse the value when you test a query hint. The ASTQueryHintOptimizer will take care of attaching the query hint to the AST node(s) in the appropriate scope.