Statements having non-commutative connection conditions are optimized by
replacing the non-commutative connection conditions with equivalent
expressions that allow for consideration of additional connection orders
that would otherwise violate the ordering rules of the non-commutative
connection condition. Elements on the right-hand side of a
non-commutative connection condition are converted into distinct results
elements, thereby allowing the elements to be used on the left-hand side
of a commutative connection operator, while preserving accuracy of the
statement results set. This increased set of connection orders is
evaluated and the execution plan for the optimal connection order is
selected.