1. A computer-implemented method of processing a query, comprising: determining a set of candidate queries for the query based on a particular candidate identification technique; wherein the particular candidate identification technique identifies as candidate queries fewer than all semantically equivalent queries that are determinable from transformations of one or more query blocks in the query; determining costs for each candidate query of the set of candidate queries; choosing a particular query, from the set of candidate queries, based on costs for each query in the set of candidate queries; wherein each candidate query in the set of candidate queries is semantically equivalent to the query; and executing the particular query in response to a request to execute the query; wherein the method is performed by one or more computing devices.