It is becoming increasingly important to manage databases as a repository resource and to allow application programs to access this resource in a heterogeneous distributed environment. Data requested by a query are sometimes available in multiple sites such that the query becomes executable in different ways. Under this circumstance, choosing the best execution plan becomes an important task for optimizing the query execution. Until today, however, query optimization in multidatabase systems has not been discussed much in the literature. In this work, we utilize the knowledge of scope relationship of relations in multidatabases to identify the sites that will return the same results. Then, we propose a novel way of optimizing queries which takes advantage of the conflicts of schemas in searching for the execution plan with the least execution cost. We achieve the goal by first classifying various schema conflicts into different types. The costs of executing the same relational operation on relations of conflicting schemas are evaluated and a weight is assigned to each of the cases to reflect the complexity of executing the operation. As this method only involves simple iterative computations of the weights and the saving of a query execution time can be dramatic, the method developed here can be regarded as an effective way of optimizing query processing in a multidatabase environment.