# US 10,956,418 B2 · Methods and systems for joining indexes for query optimization in a multi-tenant database

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,956,418 B2
- Document ID: US10956418B2
- Status: Granted
- Kind: B2
- Application number: 15/924,023
- Filed: 2018-03-16
- Published: 2018-09-27
- Granted: 2021-03-23
- Earliest claimed: 2009-10-05
- Assignees: salesforce.com, inc.
- Applicants: salesforce.com, inc.
- Inventors: William Charles Eidson; Jesse Collins
- Web page: https://patentgrep.com/patent/US10956418B2

## CPC

- G06F 16/24544: {Join order optimisation}
- G06F 16/2246: {Trees, e.g. B+trees}
- G06F 16/2453: Query optimisation
- G06F 16/24542: {Plan optimisation}
- G06F 16/2462: {Approximate or statistical queries}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

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 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 at least a first index and a second index. Metadata associated with the data is retrieved, wherein at least a portion of the data is stored in a common table within the multi-tenant database system. A tenant-selective query syntax is determined by analyzing at least one of metadata generated from information about the tenant or metadata generated from the data accessible by the tenant. An improved query is then generated using the query syntax, wherein the improved query is based at least in part upon the original query and a result of a join between a first number of rows associated with the first index and a second number of rows associated with the second index.

## Claims

### Claim 1

A computer-implemented method of improving a query, the method comprising:
receiving, with a server computing device, an original query transmitted by a remote computing device corresponding to a tenant in a multi-tenant database system, wherein the original query is to be performed against data within a database of the multi-tenant database system and at least one column in the database comprises information for tenant-specific filtering of columns within the database, and further wherein the database includes at least a standard index and a custom index at a mapping table that specifies which users or groups of users have access to particular database rows;
retrieving, using a processor of the server computing device, 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;
determining, using the processor, a tenant-selective query syntax by analyzing at least metadata generated from tenant-specific characteristics;
analyzing, using the processor, metadata generated from information about the organization to which the original query corresponds;
generating, using the processor, an improved query using the query syntax, wherein the improved query is based at least in part upon the original query, the tenant-specific filtering of columns, the standard index and the custom index and the analysis of the metadata; and
causing the improved query to be executed on the data in the database corresponding to rows and columns within the database determined by the tenant-specific filtering of columns, the standard index and the custom index.

### Claim 2 (depends on 1)

The computer-implemented method of improving a query of claim 1 wherein the mapping table that specifies which users or groups of users have access to particular database rows further comprises mapping of users or groups of users to sub-sets of corresponding tenants to generate sub-tenants.

### Claim 3 (depends on 1)

The computer-implemented method of improving a query of claim 1 wherein the mapping table that specifies which users or groups of users have access to particular database rows further comprises mapping of a first set users or groups of users from a first tenant and a second set of users or groups of user from a second tenant to a private sharing set of users corresponding at least two tenants to generate a sub-tenant.

### Claim 4 (depends on 1)

The computer-implemented method of improving a query of claim 1 wherein the metadata comprises group definition information.

### Claim 5 (depends on 1)

The computer-implemented method of improving a query of claim 1 wherein the metadata comprises data sharing rules.

### Claim 6 (depends on 1)

The computer-implemented method of improving a query of claim 1 wherein the metadata comprises row access control information and column access control information.

### Claim 7 (depends on 1)

The computer-implemented method of improving a query of claim 1 wherein at least one group of users is determined by a join of a first table and a second table, wherein at least one of the first table and the second table comprises metadata.

### Claim 8

A non-transitory computer-readable medium having stored thereon instructions that, when executed by one or more hardware processors, are configurable to cause the one or more hardware processors to:
receive, with a server computing device, an original query transmitted by a remote computing device corresponding to a tenant in a multi-tenant database system, wherein the original query is to be performed against data within a database of the multi-tenant database system and at least one column in the database comprises information for tenant-specific filtering of columns within the database, and further wherein the database includes at least a standard index and a custom index at a mapping table that specifies which users or groups of users have access to particular database rows;
retrieve, using the server computing device, 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;
determine, using the one or more hardware processors, a tenant-selective query syntax by analyzing at least metadata generated from tenant-specific characteristics;
analyze, using the one or more hardware processors, metadata generated from information about the organization to which the original query corresponds;
generate, using the one or more hardware processors, an improved query using the query syntax, wherein the improved query is based at least in part upon the original query, the tenant-specific filtering of columns, the standard index and the custom index and the analysis of the metadata; and
cause the improved query to be executed on the data in the database corresponding to rows and columns within the database determined by the tenant-specific filtering of columns, the standard index and the custom index.

### Claim 9 (depends on 8)

The non-transitory computer-readable medium of claim 8 wherein the mapping table that specifies which users or groups of users have access to particular database rows further comprises mapping of users or groups of users to sub-sets of corresponding tenants to generate sub-tenants.

### Claim 10 (depends on 8)

The non-transitory computer-readable medium of claim 8 wherein the mapping table that specifies which users or groups of users have access to particular database rows further comprises mapping of a first set users or groups of users from a first tenant and a second set of users or groups of user from a second tenant to a private sharing set of users corresponding at least two tenants to generate a sub-tenant.

### Claim 11 (depends on 8)

The non-transitory computer-readable medium of claim 8 wherein the metadata comprises group definition information.

### Claim 12 (depends on 8)

The non-transitory computer-readable medium of claim 8 wherein the metadata comprises data sharing rules.

### Claim 13 (depends on 8)

The non-transitory computer-readable medium of claim 8 wherein the metadata comprises row access control information and column access control information.

### Claim 14 (depends on 8)

The non-transitory computer-readable medium of claim 8 wherein at least one group of users is determined by a join of a first table and a second table, wherein at least one of the first table and the second table comprises metadata.

### Claim 15

A system having at least a memory device and one or more hardware processors coupled with the memory device, wherein the one or more hardware processors are configurable to:
receive, with a server computing device, an original query transmitted by a remote computing device corresponding to a tenant in a multi-tenant database system, wherein the original query is to be performed against data within a database of the multi-tenant database system and at least one column in the database comprises information for tenant-specific filtering of columns within the database, and further wherein the database includes at least a standard index and a custom index at a mapping table that specifies which users or groups of users have access to particular database rows;
retrieve, using the server computing device, 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;
determine, using the one or more hardware processors, a tenant-selective query syntax by analyzing at least metadata generated from tenant-specific characteristics;
analyze, using the one or more hardware processors, metadata generated from information about the organization to which the original query corresponds;
generate, using the one or more hardware processors, an improved query using the query syntax, wherein the improved query is based at least in part upon the original query, the tenant-specific filtering of columns, the standard index and the custom index and the analysis of the metadata; and
cause the improved query to be executed on the data in the database corresponding to rows and columns within the database determined by the tenant-specific filtering of columns, the standard index and the custom index.

### Claim 16 (depends on 15)

The non-transitory computer-readable medium of claim 15 wherein the mapping table that specifies which users or groups of users have access to particular database rows further comprises mapping of users or groups of users to sub-sets of corresponding tenants to generate sub-tenants.

### Claim 17 (depends on 15)

The non-transitory computer-readable medium of claim 15 wherein the mapping table that specifies which users or groups of users have access to particular database rows further comprises mapping of a first set users or groups of users from a first tenant and a second set of users or groups of user from a second tenant to a private sharing set of users corresponding at least two tenants to generate a sub-tenant.

### Claim 18 (depends on 15)

The non-transitory computer-readable medium of claim 15 wherein the metadata comprises group definition information.

### Claim 19 (depends on 15)

The non-transitory computer-readable medium of claim 15 wherein the metadata comprises data sharing rules.

### Claim 20 (depends on 15)

The non-transitory computer-readable medium of claim 15 wherein the metadata comprises row access control information and column access control information.
