1. A method, comprising: receiving a first query configured according to a query template, the first query including values for a plurality of parameters of the query template; determining that a dispatcher is not present for the first query; generating a dispatcher for the query template in response to said determining that a dispatcher is not present for the first query; defining a selectivity space as an array of selectivity regions arranged according to a logarithmic-scale grid that has a number of dimensions equal to a number of efficiency expressions of the first query; compiling the first query to generate a first query plan; determining a first selectivity region in the selectivity space for the first query using the dispatcher; generating a first key for the first query that includes an indication of the first selectivity region; storing the first query plan in association with the first key; and executing the first query plan with respect to the first query.