Optimization of join strategies in distributed databases