# US 2021/0334281 A1 · Join pattern agnostic aggregate computation in database query operations

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

- Number: US 2021/0334281 A1
- Document ID: US20210334281A1
- Status: Published application
- Kind: A1
- Application number: 17/305,387
- Filed: 2021-07-06
- Published: 2021-10-28
- Earliest claimed: 2019-05-03
- Assignees: Google Inc.
- Applicants: Google LLC
- Inventors: Lloyd Tabb; Steven Talbot
- Web page: https://patentgrep.com/patent/US20210334281A1

## CPC

- G06F 16/24537: {of operators}
- G06F 16/24556: {Aggregation; Duplicate elimination}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method of computing a join pattern agnostic aggregate function includes loading source code and parsing the source code to identify different database query operations. In response to the identification of an aggregate function in one of the different database query operations in which records in multiple tables are joined together in a table join, a multiplicity of primary keys are retrieved, each corresponding to a different one of the multiple tables and also an object of one of the tables referenced by the identified aggregate function. An existence of a fan out condition associated with the table join is then computed. On condition that an existence of the fan out condition is not computed a non-fan out sensitive implementation of the aggregate function is invoked with respect to the object. But, otherwise, a different, fan-out sensitive implementation of the aggregate function is invoked with respect to the object.

## Claims

### Claim 1

A computer-implemented method when executed on data processing hardware causes the data processing hardware to perform operations comprising:
receiving an operation request to perform an operation upon an object of a particular table previously subject to a table join operation including two or more underlying tables;
determining whether the particular table satisfies a fan out condition based on primary keys associated with the two or more underlying tables; and
in response to determining the particular table satisfies the fan out condition:
extracting, using the primary keys associated with the two or more underlying tables, unique values from the object of the particular table;
generating, using the extracted unique values, an object of a modified table; and
performing the operation request upon the object of the modified table.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein determining whether the particular table satisfies the fan out condition based on the primary keys associated with the two or more underlying tables comprises:
determining a first number of rows of the particular table;
determining a second number of rows of one of the two or more underlying tables; and
comparing the first number of rows of the particular table to the second number of rows of the one of the two or more underlying tables.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, wherein the particular table satisfies the fan out condition when the first number of rows of the particular table is greater than the second number of rows of the one of the two or more underlying tables.

### Claim 4 (depends on 2)

The computer-implemented method of claim 2, wherein the particular table fails to satisfy the fan out condition when the first number of rows of the particular table is equal to the second number of rows of each underlying table from the two or more underlying tables.

### Claim 5 (depends on 4)

The computer-implemented method of claim 4, wherein, in response to determining the particular table fails to satisfy the fan out condition, the operations further comprise performing the operation request upon the object of the particular table.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, wherein the operation request to perform the operation comprises an aggregate function.

### Claim 7 (depends on 6)

The computer-implemented method of claim 6, wherein the aggregate function comprises one of:
a sum function;
an average function;
a standard deviation function; or
a count function.

### Claim 8 (depends on 1)

The computer-implemented method of claim 1, wherein the table join operation comprises one of:
an inner table join;
a left table join;
a right table join; or
a full table join.

### Claim 9 (depends on 1)

The computer-implemented method of claim 1, wherein the primary keys associated with the two or more underlying tables uniquely identify each row of the two or more underlying tables.

### Claim 10 (depends on 1)

The computer-implemented method of claim 1, wherein the particular table is stored at a relationship database management system.

### Claim 11

A system comprising:
data processing hardware; and
memory hardware in communication with the data processing hardware, the memory hardware storing instructions that when executed on the data processing hardware cause the data processing hardware to perform operations comprising:
receiving an operation request to perform an operation upon an object of a particular table previously subject to a table join operation including two or more underlying tables;
determining whether the particular table satisfies a fan out condition based on primary keys associated with the two or more underlying tables; and
in response to determining the particular table satisfies the fan out condition:
extracting, using the primary keys associated with the two or more underlying tables, unique values from the object of the particular table;
generating, using the extracted unique values, an object of a modified table; and
performing the operation request upon the object of the modified table.

### Claim 12 (depends on 11)

The system of claim 11, wherein determining whether the particular table satisfies the fan out condition based on the primary keys associated with the two or more underlying tables comprises:
determining a first number of rows of the particular table;
determining a second number of rows of one of the two or more underlying tables; and
comparing the first number of rows of the particular table to the second number of rows of the one of the two or more underlying tables.

### Claim 13 (depends on 12)

The system of claim 12, wherein the particular table satisfies the fan out condition when the first number of rows of the particular table is greater than the second number of rows of the one of the two or more underlying tables.

### Claim 14 (depends on 12)

The system of claim 12, wherein the particular table fails to satisfy the fan out condition when the first number of rows of the particular table is equal to the second number of rows of each underlying table from the two or more underlying tables.

### Claim 15 (depends on 14)

The system of claim 14, wherein, in response to determining the particular table fails to satisfy the fan out condition, the operations further comprise performing the operation request upon the object of the particular table.

### Claim 16 (depends on 11)

The system of claim 11, wherein the operation request to perform the operation comprises an aggregate function.

### Claim 17 (depends on 16)

The system of claim 16, wherein the aggregate function comprises one of:
a sum function;
an average function;
a standard deviation function; or
a count function.

### Claim 18 (depends on 11)

The system of claim 11, wherein the table join operation comprises one of:
an inner table join;
a left table join;
a right table join; or
a full table join.

### Claim 19 (depends on 11)

The system of claim 11, wherein the primary keys associated with the two or more underlying tables uniquely identify each row of the two or more underlying tables.

### Claim 20 (depends on 11)

The system of claim 11, wherein the particular table is stored at a relationship database management system.
