# US 2015/0088856 A1 · Inferring dimensional metadata from content of a query

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

- Number: US 2015/0088856 A1
- Document ID: US20150088856A1
- Status: Published application
- Kind: A1
- Application number: 14/033,285
- Filed: 2013-09-20
- Published: 2015-03-26
- Earliest claimed: 2013-09-20
- Assignees: Oracle International Corporation
- Applicants: Oracle International Corporation
- Inventors: JAMES HUNTER; ADAM KOCIUBES
- Web page: https://patentgrep.com/patent/US20150088856A1

## CPC

- G06F 16/24544: {Join order optimisation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Methods, computer systems, and stored instructions are described herein for inferring dimensional metadata from content of a query that references tables. A server analyzes the content of the query to determine which table(s) of the referenced tables could be fact tables and/or which table(s) of the referenced tables could be dimension tables. The server transforms the query to a transformed query that operates on a candidate fact table and candidate dimension table(s) of the referenced tables other than the candidate fact table. The transformed query, when executed, processes at least some data from dimension(s) using the candidate dimension table(s) before processing at least some data from the candidate fact table. Alternatively or additionally, the server generates an execution plan that operates on the candidate fact table and the candidate dimension table(s). The execution plan, when performed, processes data from dimension(s) using the candidate dimension table(s) before processing data from the candidate fact table.

## Claims

### Claim 1

A method comprising:
storing a query that references multiple tables;
analyzing content of the query to determine which of the multiple tables could be fact tables, wherein the multiple tables include one or more candidate fact tables that could be fact tables and one or more other tables that could not be fact tables;
based at least in part on determining which of the multiple tables could be fact tables, generating an execution plan for the query, the execution plan operating on a candidate fact table of the one or more candidate fact tables and one or more candidate dimension tables of the referenced multiple tables other than the candidate fact table; wherein the execution plan, when performed, processes at least some data from at least one dimension using at least one of the one or more candidate dimension tables before processing at least some data from the candidate fact table;
wherein the method is performed by one or more computing devices.

### Claim 2 (depends on 1)

The method of claim 1, wherein determining which of the multiple tables could be fact tables comprises determining which of the multiple tables are referenced by aggregation operators.

### Claim 3 (depends on 1)

The method of claim 1, wherein determining which of the multiple tables could be fact tables does not account for sizes of the multiple tables.

### Claim 4 (depends on 3)

The method of claim 3, wherein multiple execution plans are generated for the query, the multiple execution plans including one or more execution plans for each of the one or more candidate fact tables, the method further comprising selecting, from among the multiple execution plans, the execution plan that operates on the candidate fact table and the one or more candidate dimension tables based at least in part on a size of the candidate fact table.

### Claim 5 (depends on 1)

The method of claim 1, further comprising identifying the one or more candidate dimension tables at least in part by determining, based at least in part on the content of the query, that the candidate fact table appears in one or more equijoins with the one or more candidate dimension tables.

### Claim 6

A method comprising:
storing a query that references multiple tables;
analyzing content of the query to determine which of the multiple tables could be fact tables, wherein the multiple tables include one or more candidate fact tables that could be fact tables and one or more other tables that could not be fact tables;
based at least in part on determining which of the multiple tables could be fact tables, transforming the query to a transformed query that operates on a candidate fact table of the one or more candidate fact tables and one or more candidate dimension tables of the referenced multiple tables other than the candidate fact table; wherein the transformed query, when executed, processes at least some data from at least one dimension using at least one of the one or more candidate dimension tables before processing at least some data from the candidate fact table;
wherein the method is performed by one or more computing devices.

### Claim 7 (depends on 6)

The method of claim 6, wherein determining which of the multiple tables could be fact tables comprises determining which of the multiple tables are referenced by aggregation operators.

### Claim 8 (depends on 6)

The method of claim 6, wherein determining which of the multiple tables could be fact tables does not account for sizes of the multiple tables.

### Claim 9 (depends on 8)

The method of claim 8, wherein the query is transformed into multiple transformed queries, including one or more transformed queries for each of the one or more candidate fact tables, the method further comprising selecting, from among the multiple transformed queries, the transformed query that operates on the candidate fact table and the one or more candidate dimension tables based at least in part on a size of the candidate fact table.

### Claim 10 (depends on 6)

The method of claim 6, further comprising identifying the one or more candidate dimension tables at least in part by determining, based at least in part on the content of the query, that the candidate fact table appears in one or more equijoins with the one or more candidate dimension tables.

### Claim 11 (depends on 6)

The method of claim 6, further comprising:
determining that the query includes a particular fact key that is joined to a particular dimension key and that the query includes a group by operation that references the particular fact key; and
based at least in part on determining that the query includes the particular fact key that is joined to the particular dimension key and that the query includes a group by operation that references the particular fact key, replacing the particular fact key in the group by operation with the particular dimension key.

### Claim 12 (depends on 6)

The method of claim 6, further comprising:
determining that the query includes a maximum or minimum operation that references a group by operation and a particular column that would otherwise qualify as a dimension; and
based at least in part on determining that the query includes the maximum or minimum operation that references the particular column that would otherwise qualify as the dimension, moving the particular column out of the maximum or minimum operation and into the group by operation.

### Claim 13 (depends on 6)

The method of claim 6, further comprising:
determining that the query includes one or more redundant join operations; and
based at least in part on determining that the query includes the one or more redundant join operations, removing at least one of the one or more redundant join operations from the query.

### Claim 14

One or more non-transitory computer-readable storage media storing instructions which, when executed, cause:
storing a query that references multiple tables;
analyzing content of the query to determine which of the multiple tables could be fact tables, wherein the multiple tables include one or more candidate fact tables that could be fact tables and one or more other tables that could not be fact tables;
based at least in part on determining which of the multiple tables could be fact tables, generating an execution plan for the query, the execution plan operating on a candidate fact table of the one or more candidate fact tables and one or more candidate dimension tables of the referenced multiple tables other than the candidate fact table; wherein the execution plan, when performed, processes at least some data from at least one dimension using at least one of the one or more candidate dimension tables before processing at least some data from the candidate fact table.

### Claim 15 (depends on 14)

The one or more non-transitory computer-readable storage media of claim 14, wherein the instructions, when executed, cause determining which of the multiple tables could be fact tables at least in part by determining which of the multiple tables are referenced by aggregation operators.

### Claim 16 (depends on 14)

The one or more non-transitory computer-readable storage media of claim 14, wherein the instructions, when executed, cause determining which of the multiple tables could be fact tables without accounting for sizes of the multiple tables.

### Claim 17 (depends on 16)

The one or more non-transitory computer-readable storage media of claim 16, wherein multiple execution plans are generated for the query, the multiple execution plans including one or more execution plans for each of the one or more candidate fact tables, and wherein the instructions, when executed, further cause selecting, from among the multiple execution plans, the execution plan that operates on the candidate fact table and the one or more candidate dimension tables based at least in part on a size of the candidate fact table.

### Claim 18 (depends on 14)

The one or more non-transitory computer-readable storage media of claim 14, wherein the instructions, when executed, further cause identifying the one or more candidate dimension tables at least in part by determining, based at least in part on the content of the query, that the candidate fact table appears in one or more equijoins with the one or more candidate dimension tables.

### Claim 19

One or more non-transitory computer-readable storage media storing instructions which, when executed, cause:
storing a query that references multiple tables;
analyzing content of the query to determine which of the multiple tables could be fact tables, wherein the multiple tables include one or more candidate fact tables that could be fact tables and one or more other tables that could not be fact tables;
based at least in part on determining which of the multiple tables could be fact tables, transforming the query to a transformed query that operates on a candidate fact table of the one or more candidate fact tables and one or more candidate dimension tables of the referenced multiple tables other than the candidate fact table; wherein the transformed query, when executed, processes at least some data from at least one dimension using at least one of the one or more candidate dimension tables before processing at least some data from the candidate fact table.

### Claim 20 (depends on 19)

The one or more non-transitory computer-readable storage media of claim 19, wherein the instructions, when executed, cause determining which of the multiple tables could be fact tables at least in part by determining which of the multiple tables are referenced by aggregation operators.

### Claim 21 (depends on 19)

The one or more non-transitory computer-readable storage media of claim 19, wherein the instructions, when executed, cause determining which of the multiple tables could be fact tables without accounting for sizes of the multiple tables.

### Claim 22 (depends on 21)

The one or more non-transitory computer-readable storage media of claim 21, wherein the query is transformed into multiple transformed queries, including one or more transformed queries for each of the one or more candidate fact tables, and wherein the instructions, when executed, further cause selecting, from among the multiple transformed queries, the transformed query that operates on the candidate fact table and the one or more candidate dimension tables based at least in part on a size of the candidate fact table.

### Claim 23 (depends on 19)

The one or more non-transitory computer-readable storage media of claim 19, wherein the instructions, when executed, further cause identifying the one or more candidate dimension tables at least in part by determining, based at least in part on the content of the query, that the candidate fact table appears in one or more equijoins with the one or more candidate dimension tables.

### Claim 24 (depends on 19)

The one or more non-transitory computer-readable storage media of claim 19, wherein the instructions, when executed, further cause:
determining that the query includes a particular fact key that is joined to a particular dimension key and that the query includes a group by operation that references the particular fact key; and
based at least in part on determining that the query includes the particular fact key that is joined to the particular dimension key and that the query includes a group by operation that references the particular fact key, replacing the particular fact key in the group by operation with the particular dimension key.

### Claim 25 (depends on 19)

The one or more non-transitory computer-readable storage media of claim 19, wherein the instructions, when executed, further cause:
determining that the query includes a maximum or minimum operation that references a group by operation and a particular column that would otherwise qualify as a dimension; and
based at least in part on determining that the query includes the maximum or minimum operation that references the particular column that would otherwise qualify as the dimension, moving the particular column out of the maximum or minimum operation and into the group by operation.

### Claim 26 (depends on 19)

The one or more non-transitory computer-readable storage media of claim 19, wherein the instructions, when executed, further cause:
determining that the query includes one or more redundant join operations; and
based at least in part on determining that the query includes the one or more redundant join operations, removing at least one of the one or more redundant join operations from the query.
