Optimized elimination ordering