# US 12,117,999 B2 · Masking shard operations in distributed database systems

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

- Number: US 12,117,999 B2
- Document ID: US12117999B2
- Status: Granted
- Kind: B2
- Application number: 17/488,450
- Filed: 2021-09-29
- Published: 2023-03-30
- Granted: 2024-10-15
- Earliest claimed: 2021-09-29
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Shuo Li; Xiaobo Wang; Sheng Yan Sun; Leilei Li
- Web page: https://patentgrep.com/patent/US12117999B2

## CPC

- G06F 16/24534: {Query rewriting; Transformation}
- G06F 16/278: {Data partitioning, e.g. horizontal or vertical partitioning}
- G06F 16/2282: {Tablespace storage structures; Management thereof}
- G06F 16/2358: {Change logging, detection, and notification (replication G06F16/27)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A computer-implemented method masks shard operations in a distributed database. The method includes performing a shard operation on a first table with a first column and a second column, where the shard operation divides the first table into a first shard with the first column and a second shard with the second column. The method also includes receiving a query, where the query is configured to perform at least a first command. The method further includes determining the first command is directed to the first column. The method includes updating the query to access the first shard in place of the first table. The method also includes executing the query and returning a set of results for the query to a source of the query.

## Claims

### Claim 1

A computer-implemented method comprising:
performing a vertical shard operation on a first table with a first column and a second column, wherein the shard operation divides the first table into a first shard with the first column and a second shard with the second column;
receiving a query, wherein the query is configured to perform at least a first command;
determining the first command is directed to the first column on the first table;
updating the query to access the first shard in place of the first table, wherein the updating includes rewriting the first command;
executing the query; and
returning a set of results for the query to a source of the query.

### Claim 2 (depends on 1)

The method of claim 1, wherein the set of results for the query is the same as if the query is executed on the first table prior to performing the shard operation.

### Claim 3 (depends on 1)

The method of claim 1, wherein the updating the query is based on a configuration file.

### Claim 4 (depends on 3)

The method of claim 3, further comprising:
mapping, using the configuration file, the first column from the first table to the first shard and the second column to the second shard.

### Claim 5 (depends on 4)

The method of claim 4, wherein the updating includes replacing a table name in the query with a first shard name, wherein the table name and the first shard name are included in the configuration file.

### Claim 6 (depends on 5)

The method of claim 5, wherein the first command includes a first predicate based on the second column in the second shard.

### Claim 7 (depends on 6)

The method of claim 6, wherein the first predicate of the second shard is aligned with the first command targeting the first shard by a sequence identifier.

### Claim 8 (depends on 5)

The method of claim 5, wherein the query includes a second command directed to the second shard.

### Claim 9 (depends on 1)

The method of claim 1, wherein:
the first command is a select command; and
the updating the query includes rewriting the first command using a common table expression pattern.

### Claim 10 (depends on 1)

The method of claim 1, wherein:
the first command is a delete command; and
the updating the query includes rewriting the first command with new base table join pattern to consolidate multiple deletes into one statement.

### Claim 11 (depends on 1)

The method of claim 1, wherein:
the first command is an insert command; and
the updating the query includes rewriting the first command with an ‘insert include’ clause and select from final pattern to consolidate multiple inserts into one statement.

### Claim 12 (depends on 1)

The method of claim 1, wherein:
the first command is an update command; and
the updating the query includes rewriting first command select from final pattern to update multiple updates into one statement.

### Claim 13

A system comprising:
a processor; and
a computer-readable storage medium communicatively coupled to the processor and storing program instructions which, when executed by the processor, are configured to cause the processor to:
perform a vertical shard operation on a first table with a first column and a second column, wherein the shard operation divides the first table into a first shard with the first column and a second shard with the second column;
receive a query, wherein the query is configured to perform at least a first command;
determine the first command is directed to the first column on the first table;
update the query to access the first shard in place of the first table, wherein the updating includes rewriting the first command;
execute the query; and
return a set of results for the query to a source of the query.

### Claim 14 (depends on 13)

The system of claim 13, wherein the updating the query is based on a configuration file.

### Claim 15 (depends on 14)

The system of claim 14, wherein the configuration file is used to map the first column from the first table to the first shard and the second column to the second shard.

### Claim 16 (depends on 15)

The system of claim 15, wherein the updating includes replacing a table name in the query with a first shard name, wherein the table name and the first shard name are included in the configuration file.

### Claim 17

A computer program product, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions executable by a processing unit to cause the processing unit to:
perform a shard vertical operation on a first table with a first column and a second column, wherein the shard operation divides the first table into a first shard with the first column and a second shard with the second column;
receive a query, wherein the query is configured to perform at least a first command;
determine the first command is directed to the first column on the first table;
update the query to access the first shard in place of the first table, wherein the updating includes rewriting the first command;
execute the query; and
return a set of results for the query to a source of the query.

### Claim 18 (depends on 17)

The computer program product of claim 17, wherein the updating the query is based on a configuration file.

### Claim 19 (depends on 18)

The computer program product of claim 18, wherein the configuration file is used to map the first column from the first table to the first shard and the second column to the second shard.

### Claim 20 (depends on 19)

The computer program product of claim 19, wherein the updating includes replacing a table name in the query with a first shard name, wherein the table name and the first shard name are included in the configuration file.
