12. A non-transitory computer-readable medium containing program code executable by a processor in a computer to improve a query in a multi-tenant database system, the program code including instructions to: receiving at a network interface of a server 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 only by the tenant, and wherein the multi-tenant database system includes at least a first index and a second index, wherein the first index is a standard index and wherein the second index is a custom index to provide a private sharing paradigm within the multi-tenant database system that allows groups defined within one or more particular tenants to share information only among members of that group; retrieving, using a processor of the server, metadata associated with the data accessible only by the tenant in the multi-tenant database system, wherein at least a portion of the data accessible only by the tenant is stored in a common table within the multi-tenant database system; scanning a first index column to identify a first set of rows, wherein the first index column is selected based on the original query; scanning a second index column to identify a second set of rows, wherein the second index column is based on the original query; determining a third set of rows corresponding to an intersection of the first set of rows and the second set of rows; determining, using the processor, a tenant-selective query syntax, 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; and generating, using the processor, an improved query using the query syntax, wherein the improved query is based upon the original query and the third set of rows.
12. A non-transitory computer-readable medium containing program code executable by a processor in a computer to improve a query in a multi-tenant database system, the program code including instructions to: receiving at a network interface of a server 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 only by the tenant, and wherein the multi-tenant database system includes at least a first index and a second index, wherein the first index is a standard index and wherein the second index is a custom index to provide a private sharing paradigm within the multi-tenant database system that allows groups defined within one or more particular tenants to share information only among members of that group; retrieving, using a processor of the server, metadata associated with the data accessible only by the tenant in the multi-tenant database system, wherein at least a portion of the data accessible only by the tenant is stored in a common table within the multi-tenant database system; scanning a first index column to identify a first set of rows, wherein the first index column is selected based on the original query; scanning a second index column to identify a second set of rows, wherein the second index column is based on the original query; determining a third set of rows corresponding to an intersection of the first set of rows and the second set of rows; determining, using the processor, a tenant-selective query syntax, 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; and generating, using the processor, an improved query using the query syntax, wherein the improved query is based upon the original query and the third set of rows. 22. The computer-readable medium of claim 12 , wherein the second number of rows associated with the second index is determined by joining a set of primary keys of the second index with a primary keys index of the common table.