1. A method for optimizing a query by a database system in a multi-tenant database system, the method comprising: receiving a query request with a query predicate to filter data returned in response to the query request, wherein the query predicate comprises a formula; accessing an index generated to correspond to one tenant of the multi-tenant database system; preprocessing the formula in the query predicate based upon the generated index for the tenant to create a transformed query request, wherein the preprocessing includes: applying the generated index to a database field referenced in the formula, and replacing at least one reference to a database field within the formula with a reference to a second database field based upon the generated index; optimizing the query request using the transformed query request; receiving a query request with a reference to a first database field in the query predicate, wherein the first database field comprises the formula in the query predicate, wherein the formula comprises a reference to a second database field; and transforming the query request to a transformed query request by replacing the reference to the first database field within the query request with at least one reference to the second database field.