Patent attributes
Methods and systems for query optimization for a multi-tenant database system are provided. Some embodiments comprise receiving, at a network interface of a server computer in a multi-tenant database system, an original query transmitted to the multi-tenant database system by a user associated with a tenant, wherein the original query is associated with data accessible by the tenant, and wherein the multi-tenant database system includes a first two-column custom index. Metadata associated with the data accessible by the tenant is retrieved, using a processor of the server computer, wherein at least a portion of the data accessible by the tenant is stored in a common table within the multi-tenant database system. A tenant-selective query syntax is determined, using the processor, wherein determining comprises analyzing at least one of metadata generated from information about the tenant or metadata generated from the data accessible by the tenant. Finally, using the processor, an improved query is generated using the query syntax, wherein the improved query is based at least in part upon the original query and data stored in the first two-column custom index.