# US 2022/0292098 A1 · Join query processing using pruning index

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

- Number: US 2022/0292098 A1
- Document ID: US20220292098A1
- Status: Published application
- Kind: A1
- Application number: 17/804,630
- Filed: 2022-05-31
- Published: 2022-09-15
- Earliest claimed: 2019-12-26
- Assignees: Snowflake Inc.
- Applicants: Snowflake Inc.
- Inventors: Max Heimel; Ismail Oukid; Linnea Passing; Stefan Richter; Juliane K. Waack
- Web page: https://patentgrep.com/patent/US20220292098A1

## CPC

- G06F 16/2255: {Hash tables}
- G06F 16/24557: {Efficient disk access during query execution}
- G06F 16/2272: {Management thereof}
- G06F 16/24549: {Run-time optimisation}
- G06F 16/283: {Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP}
- G06F 16/9035: Filtering based on additional data, e.g. user or group profiles
- G06F 17/18: for evaluating statistical data {, e.g. average values, frequency distributions, probability functions, regression analysis (forecasting specially adapted for a specific administrative, business or logistic context G06Q10/04)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A query directed at a table organized into a set of batch units is received. The query comprises a predicate for which values are unknown prior to runtime. A set of values for the predicate are determined based on the query. An index access plan is created based on the set of values. Based on the index access plan, the set of batch units are pruned using a pruning index associated with the table. The pruning index comprises a set of filters that index distinct values in each column of the table. The pruning of the set of batch units comprises identifying a subset of batch units to scan for data that satisfies the query. The subset of batch units of the table are scanned to identify data that satisfies the query.

## Claims

### Claim 1

A system comprising:
at least one hardware processor; and
at least one memory storing instructions that cause the at least one hardware processor to perform operations comprising:
receiving a query comprising a join clause to combine rows from a first table and a second table, the first table being organized into a set of batch units;
collecting a set of build-side values from the second table based on performing a build phase in response to the join clause being included in the query;
creating an index access plan based on the set of build-side values;
based on the index access plan, pruning the set of batch units using a pruning index associated with the first table, the pruning index comprising a set of filters that index distinct values in each column of the first table, the pruning of the set of batch units comprising identifying a subset of batch units to scan for data that satisfies the query; and
performing a probe phase, the performing of the probe phase comprising scanning the subset of batch units of the first table to identify data that satisfies the query.

### Claim 2 (depends on 1)

The system of claim 1, wherein the operations further comprise:
evaluating whether to use the pruning index in pruning the set of batch units based on a cost function.

### Claim 3 (depends on 2)

The system of claim 2, wherein the evaluating whether to use the pruning index in pruning the set of batch units comprises:
determining whether the set of build-side values satisfy a threshold size constraint, wherein the pruning of the set of batch units using the pruning index is based on determining the set of build-side values satisfy the threshold size constraint.

### Claim 4 (depends on 2)

The system of claim 2, wherein the evaluating whether to use the pruning index in pruning the set of batch units comprises:
determining whether the set of batch units satisfy a threshold size constraint, wherein the pruning of the set of batch units using the pruning index is based on determining the set of batch units satisfy the threshold size constraint.

### Claim 5 (depends on 1)

The system of claim 1, wherein the creating of the index access plan comprises generating a data structure based on the set of build-side values.

### Claim 6 (depends on 5)

The system of claim 5, wherein the data structure comprises a list of one or more build-side values.

### Claim 7 (depends on 1)

The system of claim 1, wherein the operations further comprise:
generating the pruning index based on the table in an offline process prior to receiving the query.

### Claim 8 (depends on 7)

The system of claim 7, wherein:
generating the pruning index comprises generating a filter for each batch unit of the set of batch units in the table; and
the generating of the filter for each batch unit comprises generating a first filter for a first batch unit by performing operations comprising:
for a given data value in the first batch unit, generating at least one fingerprint for the data value; and
populating the first filter using the at least one fingerprint for the data value.

### Claim 9 (depends on 1)

The system of claim 1, wherein performing the build phase comprises building a hash table based on the set of build-side values using a join attribute as a hash key.

### Claim 10 (depends on 9)

The system of claim 9, wherein performing the probe phase comprises:
reading a row from the subset of batch units of the first table; and
probing the hash table for a matching row using the join attribute as a lookup key.

### Claim 11

A method comprising:
receiving a query comprising a join clause to combine rows from a first table and a second table, the first table being organized into a set of batch units;
collecting a set of build-side values from the second table based on performing a build phase in response to the join clause being included in the query;
creating an index access plan based on the set of build-side values;
based on the index access plan, pruning, by at least one hardware processor, the set of batch units using a pruning index associated with the first table, the pruning index comprising a set of filters that index distinct values in each column of the first table, the pruning of the set of batch units comprising identifying a subset of batch units to scan for data that satisfies the query; and
performing a probe phase, the performing of the probe phase comprising scanning the subset of batch units of the first table to identify data that satisfies the query.

### Claim 12 (depends on 11)

The method of claim 11, further comprising:
evaluating whether to use the pruning index in pruning the set of batch units based on a cost function.

### Claim 13 (depends on 12)

The method of claim 12, wherein the evaluating whether to use the pruning index in pruning the set of batch units comprises:
determining whether the set of build-side values satisfy a threshold size constraint, wherein the pruning of the set of batch units using the pruning index is based on determining the set of build-side values satisfy the threshold size constraint.

### Claim 14 (depends on 12)

The method of claim 12, wherein the evaluating whether to use the pruning index in pruning the set of batch units comprises:
determining whether the set of batch units satisfy a threshold size constraint, wherein the pruning of the set of batch units using the pruning index is based on determining the set of batch units satisfy the threshold size constraint.

### Claim 15 (depends on 11)

The method of claim 11, wherein the creating of the index access plan comprises generating a data structure based on the set of build-side values.

### Claim 16 (depends on 15)

The method of claim 15, wherein the data structure comprises a list of one or more build-side values.

### Claim 17 (depends on 11)

The method of claim 11, further comprising:
generating the pruning index based on the table in an offline process prior to receiving the query.

### Claim 18 (depends on 17)

The method of claim 17, wherein:
generating the pruning index comprises generating a filter for each batch unit of the set of batch units in the table; and
the generating of the filter for each batch unit comprises generating a first filter for a first batch unit by performing operations comprising:
for a given data value in the first batch unit, generating at least one fingerprint for the data value; and
populating the first filter using the at least one fingerprint for the data value.

### Claim 19 (depends on 11)

The method of claim 11, wherein performing the build phase comprises building a hash table based on the set of build-side values using a join attribute as a hash key.

### Claim 20 (depends on 19)

The method of claim 19, wherein performing the probe phase comprises:
reading a row from the subset of batch units of the first table; and
probing the hash table for a matching row using the join attribute as a lookup key.

### Claim 21

A computer-storage medium comprising instructions that, when executed by one or more processors of a machine, configure the machine to perform operations comprising:
receiving a query comprising a join clause to combine rows from a first table and a second table, the first table being organized into a set of batch units;
collecting a set of build-side values from the second table based on performing a build phase in response to the join clause being included in the query;
creating an index access plan based on the set of build-side values;
based on the index access plan, pruning the set of batch units using a pruning index associated with the first table, the pruning index comprising a set of filters that index distinct values in each column of the first table, the pruning of the set of batch units comprising identifying a subset of batch units to scan for data that satisfies the query; and
performing a probe phase, the performing of the probe phase comprising scanning the subset of batch units of the first table to identify data that satisfies the query.

### Claim 22 (depends on 21)

The computer-storage medium of claim 21, wherein the operations further comprise:
evaluating whether to use the pruning index in pruning the set of batch units based on a cost function.

### Claim 23 (depends on 22)

The computer-storage medium of claim 22, wherein the evaluating whether to use the pruning index in pruning the set of batch units comprises:
determining whether the set of build-side values satisfy a threshold size constraint, wherein the pruning of the set of batch units using the pruning index is based on determining the set of build-side values satisfy the threshold size constraint.

### Claim 24 (depends on 22)

The computer-storage medium of claim 22, wherein the evaluating whether to use the pruning index in pruning the set of batch units comprises:
determining whether the set of batch units satisfy a threshold size constraint, wherein the pruning of the set of batch units using the pruning index is based on determining the set of batch units satisfy the threshold size constraint.

### Claim 25 (depends on 21)

The computer-storage medium of claim 21, wherein the creating of the index access plan comprises generating a data structure based on the set of build-side values.

### Claim 26 (depends on 25)

The computer-storage medium of claim 25, wherein the data structure comprises a list of one or more build-side values.

### Claim 27 (depends on 21)

The computer-storage medium of claim 21, wherein the operations further comprise:
generating the pruning index based on the table in an offline process prior to receiving the query.

### Claim 28 (depends on 27)

The computer-storage medium of claim 27, wherein:
generating the pruning index comprises generating a filter for each batch unit of the set of batch units in the table; and
the generating of the filter for each batch unit comprises generating a first filter for a first batch unit by performing operations comprising:
for a given data value in the first batch unit, generating at least one fingerprint for the data value; and
populating the first filter using the at least one fingerprint for the data value.

### Claim 29 (depends on 21)

The computer-storage medium of claim 21, wherein performing the build phase comprises building a hash table based on the set of build-side values using a join attribute as a hash key.

### Claim 30 (depends on 29)

The computer-storage medium of claim 29, wherein performing the probe phase comprises:
reading a row from the subset of batch units of the first table; and
probing the hash table for a matching row using the join attribute as a lookup key.
