# US 2017/0255672 A1 · Adjusting a quantity of hash partitions for a hash join operation

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

- Number: US 2017/0255672 A1
- Document ID: US20170255672A1
- Status: Published application
- Kind: A1
- Application number: 15/060,086
- Filed: 2016-03-03
- Published: 2017-09-07
- Earliest claimed: 2016-03-03
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Gopi K. Attaluri; Vijayshankar Raman; David C. Sharpe
- Web page: https://patentgrep.com/patent/US20170255672A1

## CPC

- G06F 16/2456: {Join operations}
- G06F 16/2255: {Hash tables}
- G06F 16/24554: {Unary operations; Data partitioning operations}
- G06F 16/27: Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method implemented by at least one processing device, a processing device, and a computer program product are provided for adjusting hash partitions for a hash join operation. An amount of rows within each of an initial number of hash partitions is determined during assignment of respective rows to respective hash partitions. The initial number of hash partitions is adjusted to a final number of hash partitions based on the amount of rows within each of the initial number of hash partitions and an amount of available memory. The adjusting further includes determining the final number of hash partitions based on the amount of rows within each of the initial number of hash partitions and the amount of available memory, and assigning the rows to the final number of hash partitions. The hash join operation is then performed.

## Claims

### Claim at position 1

1-7. (canceled)

### Claim 8

A processing device comprising:
at least one processor;
a memory; and
a communication bus connecting the at least one processor with the memory, wherein the memory has stored therein instructions, which when executed by the at least one processor cause the processing device to perform a method comprising:
determining an amount of rows within each hash partition of an initial number of hash partitions, during assignment of respective rows to respective hash partitions, the initial number of hash partitions being based on static information and a historical amount of available memory;
adjusting the initial number of hash partitions to a final number of hash partitions based on the amount of rows within each of the initial number of hash partitions and an amount of available memory, the adjusting further comprising:
determining the final number of hash partitions based on the amount of rows within each of the initial number of hash partitions and the amount of available memory, and assigning the rows to the final number of hash partitions; and
performing the hash join operation with the final number of hash partitions.

### Claim 9 (depends on 8)

The processing device of claim 8, wherein the method further comprises:
creating simulated hash partitions, each of the initial number of hash partitions corresponds to at least one respective simulated hash partition;
determining an amount of rows corresponding to each of the simulated hash partitions; and
increasing an amount of hash partitions to the final number of hash partitions, the final number being larger than a current number of hash partitions so that each of the final number of hash partitions fits into the amount of available memory.

### Claim 10 (depends on 8)

The processing device of claim 8, wherein the method further comprises:
creating simulated hash partitions, each of the initial number of hash partitions corresponds to at least one respective simulated hash partition;
determining an amount of rows corresponding to each of the simulated hash partitions; and
combining ones of the hash partitions to create the final number of hash partitions, the final number of hash partitions being smaller than a current number of hash partitions so that each of the final number of hash partitions fits into the amount of available memory and performance of the hash join operation is improved.

### Claim 11 (depends on 8)

The processing device of claim 8, wherein each of the initial number of hash partitions corresponds to a plurality of respective simulated hash partitions.

### Claim 12 (depends on 9)

The processing device of claim 9, wherein an amount of rows corresponding to each of the final number of hash partitions is based on the determined amount of rows of each of the corresponding simulated hash partitions.

### Claim 13 (depends on 10)

The processing device of claim 10, wherein the final number of hash partitions is one hash partition.

### Claim 14 (depends on 8)

The processing device of claim 8, wherein each of the final number of hash partitions includes a respective distinct hash table.

### Claim 15

A computer program product comprising:
a computer readable storage medium having computer readable program code embodied therewith for execution on a processing system, the computer readable program code being configured to be executed by the processing system to:
determine an amount of rows within each hash partition of an initial number of hash partitions, during assignment of respective rows to respective hash partitions, the initial number of hash partitions being based on static information and a historical amount of available memory;
adjust the initial number of hash partitions to a final number of hash partitions based on the amount of rows within each of the initial number of hash partitions and an amount of available memory, the adjusting further comprising:
determine the final number of hash partitions based on the amount of rows within each of the initial number of hash partitions and the amount of available memory, and
assign the rows to the final number of hash partitions; and
perform the hash join operation with the final number of hash partitions.

### Claim 16 (depends on 15)

The computer program product of claim 15, wherein the computer readable program code is further configured to be executed by the processing system to:
create simulated hash partitions, each of the initial number of hash partitions corresponds to at least one respective simulated hash partition;
determine an amount of rows corresponding to each of the simulated hash partitions;
increase an amount of hash partitions to the final number of hash partitions, the final number being larger than a current number of the hash partitions so that each of the final number of hash partitions fits into the amount of available memory.

### Claim 17 (depends on 15)

The computer program product of claim 15, wherein the computer readable program code is further configured to be executed by the processing system to:
create simulated hash partitions, each of the initial number of hash partitions corresponds to at least one respective simulated hash partition;
determine an amount of rows corresponding to each of the simulated hash partitions;
combining ones of the hash partitions to create the final number of hash partitions, the final number of hash partitions being smaller than the current number of hash partitions so that each of the final number of hash partitions fits into the amount of available memory and performance of the hash j oin operation is improved.

### Claim 18 (depends on 17)

The computer program product of claim 17, wherein each of the initial number of hash partitions corresponds to a plurality of respective simulated hash partitions.

### Claim 19 (depends on 16)

The computer program product of claim 16, wherein an amount of rows corresponding to each of the final number of hash partitions is based on the determined amount of rows of each of the corresponding simulated hash partitions.

### Claim 20 (depends on 15)

The computer program product of claim 15, wherein each of the final number of hash partitions includes a respective distinct hash table.
