Detect whether joins can be safely removed