Optimal distributed query processing