16. The non-transitory computer-readable storage medium of claim 14 , wherein: the step of determining a first cost for processing a first rewritten query includes determining whether a materialized view exists for the first virtual column; and the step of determining a second cost for processing a second rewritten query includes determining whether a materialized view exists for the second virtual column.
14. The non-transitory computer-readable storage medium of claim 13 , wherein the step of selecting either the first virtual column or the second virtual column comprises: determining a first cost for processing a first rewritten query, wherein the first rewritten query is based on the query and is generated by replacing, in the query, the first part of the expression with the first virtual column; determining a second cost for processing a second rewritten query, wherein the second rewritten query is based on the query and is generated by replacing, in the query, the second part of the expression with the second virtual column; determining whether the first cost is higher than the second cost; in response to determining that the first cost is higher than the second cost, selecting the second virtual column; determining whether the second cost is higher than the first cost; in response to determining that the second cost is higher than the first cost, selecting the first virtual column.