Optimizer returns the correct query order when correct statistics is passed.