# US 12,216,649 B2 · Copy avoidance via static analysis for DBMS querying

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

- Number: US 12,216,649 B2
- Document ID: US12216649B2
- Status: Granted
- Kind: B2
- Application number: 18/589,052
- Filed: 2024-02-27
- Published: 2024-08-15
- Granted: 2025-02-04
- Earliest claimed: 2023-02-14
- Assignees: Oracle International Corporation
- Applicants: Oracle International Corporation
- Inventors: Altin Alickaj; Alexander Ulrich; Lukas Stadler
- Web page: https://patentgrep.com/patent/US12216649B2

## CPC

- G06F 16/2443: {Stored procedures}
- G06F 16/217: {Database tuning (G06F16/2282 takes precedence; database performance monitoring G06F11/3409)}
- G06F 16/2219: {Large Object storage; Management thereof}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

In a computer embodiment, in a polyglot database management system (DBMS) that contains a guest language runtime environment, a database buffer is configured that the guest language runtime environment does not manage. In the polyglot DBMS, logic that is defined in a guest language is invoked to retrieve, into the database buffer, a value stored in a database in the polyglot DBMS. Compiling the logic causes semantic analyzing the logic to detect that usage of the retrieved value cannot occur after the retrieved value is overwritten in the database buffer. When detecting that such usage of the retrieved value cannot occur, the logic is executed without, after the retrieved value is overwritten in the database buffer, retaining a copy of the retrieved value in a memory region that the guest language runtime environment manages.

## Claims

### Claim 1

A method comprising:
configuring, in a polyglot database management system (DBMS) that contains a guest language runtime environment, a database buffer that the guest language runtime environment does not manage;
invoking, in the polyglot DBMS, logic that is defined in a guest language to retrieve, into the database buffer that the guest language runtime environment does not manage, a value stored in a database in the polyglot DBMS, wherein the logic contains a plurality of database invocations;
assigning a color respectively to each database invocation of the plurality of database invocations; and
executing, based on the colors of the database invocations, the logic without, after the retrieved value is overwritten in the database buffer, retaining a retained copy of the retrieved value in a memory region that the guest language runtime environment manages.

### Claim 2 (depends on 1)

The method of claim 1 further comprising generating an interference graph.

### Claim 3 (depends on 2)

The method of claim 2 wherein the interference graph is a component of a compiler graph.

### Claim 4 (depends on 3)

The method of claim 3 wherein said generating the interference graph comprises inserting a color edge into the compiler graph.

### Claim 5 (depends on 4)

The method of claim 4 wherein the compiler graph contains a distinct node respectively for each database invocation of the plurality of database invocations.

### Claim 6 (depends on 5)

The method of claim 5 wherein the color edge connects nodes of two database invocations of the plurality of database invocations.

### Claim 7 (depends on 6)

The method of claim 6 wherein the two database invocations of the plurality of database invocations are one selected from a group consisting of two database invocations that have a same color and two database invocations that have distinct respective colors.

### Claim 8 (depends on 6)

The method of claim 6 wherein:
the method further comprises detecting liveness of a particular variable at the two database invocations of the plurality of database invocations;
said inserting the color edge is responsive to said detecting.

### Claim 9 (depends on 8)

The method of claim 8 wherein said detecting liveness comprises detecting reachability in the compiler graph for a second database invocation of the plurality of database invocations from a first database invocation of the plurality of database invocations.

### Claim 10 (depends on 4)

The method of claim 4 not comprising assigning a color to the color edge.

### Claim 11 (depends on 1)

The method of claim 1 further comprising exclusively allocating the database buffer to one component selected from a group consisting of: a database request, a database statement, a database session, a database client, a computational thread, a stored procedure, a user defined function, and said logic.

### Claim 12 (depends on 11)

The method of claim 11 further comprising allocating, to the component, a plurality of database buffers that includes said database buffer.

### Claim 13 (depends on 12)

The method of claim 12 further comprising assigning a distinct color respectively to each database buffer of the plurality of database buffers.

### Claim 14 (depends on 13)

The method of claim 13 wherein the color of a particular database invocation of the plurality of database invocations indicates which database buffer of the plurality of database buffers is allocated to the particular database invocation.

### Claim 15 (depends on 14)

The method of claim 14 further comprising allocating a first database buffer of the plurality of database buffers to a first database invocation of the plurality of database invocations and a second database buffer of the plurality of database buffers to a second database invocation of the plurality of database invocations.

### Claim 16 (depends on 1)

The method of claim 1 wherein:
said invoking is a first invoking;
said assigning is a first assigning;
the method further comprises:
second invoking said logic;
second assigning a color respectively to each database invocation of the plurality of database invocations.

### Claim 17 (depends on 16)

The method of claim 16 wherein:
said first assigning is limited to a first maximum count of colors;
said second assigning is limited to a second maximum count of colors that is not the first maximum count of colors.

### Claim 18 (depends on 1)

The method of claim 1 not comprising limiting how many colors can be assigned.

### Claim 19

One or more non-transitory computer-readable media storing instructions that, when executed by one or more processors, cause:
configuring, in a polyglot database management system (DBMS) that contains a guest language runtime environment, a database buffer that the guest language runtime environment does not manage;
invoking, in the polyglot DBMS, logic that is defined in a guest language to retrieve, into the database buffer that the guest language runtime environment does not manage, a value stored in a database in the polyglot DBMS, wherein the logic contains a plurality of database invocations;
assigning a color respectively to each database invocation of the plurality of database invocations; and
executing, based on the colors of the database invocations, the logic without, after the retrieved value is overwritten in the database buffer, retaining a retained copy of the retrieved value in a memory region that the guest language runtime environment manages.

### Claim 20 (depends on 19)

The one or more non-transitory computer-readable media of claim 19 wherein the instructions further cause generating an interference graph.

### Claim 21 (depends on 20)

The one or more non-transitory computer-readable media of claim 20 wherein the interference graph is a component of a compiler graph.

### Claim 22 (depends on 21)

The one or more non-transitory computer-readable media of claim 21 wherein said generating the interference graph comprises inserting a color edge into the compiler graph.

### Claim 23 (depends on 22)

The one or more non-transitory computer-readable media of claim 22 wherein the compiler graph contains a distinct node respectively for each database invocation of the plurality of database invocations.

### Claim 24 (depends on 19)

The one or more non-transitory computer-readable media of claim 19 wherein the instructions further cause exclusively allocating the database buffer to one component selected from a group consisting of: a database request, a database statement, a database session, a database client, a computational thread, a stored procedure, a user defined function, and said logic.
