The query cost usually as an important criterion for a distributed database. The genetic algorithm is an adaptive probabilistic search algorithm, but the crossover and mutation probability usually keep a probability in traditional genetic algorithm. If the crossover probability keep a large value, the possibility of damage for genetic algorithm model is greater; In turn, if the crossover probability keep a small value, the search process will transform a slow processing or even stagnating. If the mutation probability keep a small value, a new individual can be reproduced difficultly; In turn, if the mutation probability keep a large value, the genetic algorithm will as a Pure random search algorithm. To solve this problem, proposed a improved genetic algorithm that multiple possibility of crossover and mutation based on k-means clustering algorithm. The experiment results indicate that the algorithm is effective.