1. A method of applying rules to queries, the method comprising: applying, by the one or more processors, one or more first rules to a first query to generate a modified query such that processing of the modified query is optimized for a first set of processing conditions; measuring, by the one or more processors, a degree of latency experienced during processing of the modified query under a second set of processing conditions; and generating, by the one or more processors, one or more second rules based, at least in part, on the degree of latency.