The static join optimizer uses the ancestry (definitely produced bindings from parent groups) to choose the first tail to run in the group. The problem is when there is more than one tail in the group that shares variables with the ancestry. Once the group reaches a state where it has only tails with unshared vars, it should go back to the ancestry to get the next tail. Instead it is currently just choosing the one with the lowest cardinality. This produces suboptimal join orderings.