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.
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. 11. The method of claim 1 , wherein the particular candidate identification technique is a linear query-processing technique that determines a starting query based on the query and one or more heuristics, establishes the starting query as a current-best query, and then for each query block in the starting query, determines an alternate state for the query block, and determines a current query based on the current-best query and the alternate state for the query block; wherein choosing the particular query comprises, if a current cost for the current query is better than a current-best cost for the current-best query, then establishing the current query as the current-best query, and choosing the particular query based on the current-best query.