# US 2013/0159283 A1 · Intermediate result set caching for a database system

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

- Number: US 2013/0159283 A1
- Document ID: US20130159283A1
- Status: Published application
- Kind: A1
- Application number: 13/710,665
- Filed: 2012-12-11
- Published: 2013-06-20
- Earliest claimed: 2011-12-14
- Assignees: International Business Machines Corporation
- Inventors: Bjoern Broll; Torsten Steinbach
- Web page: https://patentgrep.com/patent/US20130159283A1

## CPC

- G06F 16/2453: Query optimisation
- G06F 16/24539: {using cached or materialised query results}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for storing intermediate result sets in a database is provided. An access plan for a single query for accessing data stored in the database system is received. An intermediate result set is generated during execution of the access plan. A value of an intermediate result set rating of the intermediate result set is determined during execution of the access plan at runtime of the query for determining if the intermediate result set, generated during the execution of the access plan, is to be stored. Based on determining that the value of the intermediate result set rating meets a predefined criterion, the determined intermediate result set is stored for a longer period of time than the runtime of the query as a stored intermediate result set.

## Claims

### Claim 1

A method for storing intermediate result sets in a database system, the method comprising:
receiving an access plan for a single query for accessing data stored in the database system;
generating an intermediate result set during execution of the access plan;
determining a value of an intermediate result set rating of the intermediate result set during execution of the access plan at runtime of the query for determining if the intermediate result set, generated during the execution of the access plan, is to be stored; and
based on determining that the value of the intermediate result set rating meets a predefined criterion, storing the determined intermediate result set for a longer period of time than the runtime of the query as a stored intermediate result set.

### Claim 2 (depends on 1)

The method of claim 1, further comprising: receiving the access plan again and adapting dynamically the re-received access plan during the execution of the access plan, wherein the adaption is based on an existence of the stored intermediate result set.

### Claim 3 (depends on 2)

The method of claim 2, further comprising: locking of base data related to the stored intermediate result set before accessing the stored intermediate result set during the execution of the adapted access plan.

### Claim 4 (depends on 1)

The method of claim 1, further comprising: receiving a further access plan and adapting dynamically the further access plan during the execution of the further access plan based on an existence of the stored intermediate result set.

### Claim 5 (depends on 4)

The method of claim 4, further comprising: locking of base data related to the stored intermediate result set before accessing the stored intermediate result set during the execution of the adapted further access plan.

### Claim 6 (depends on 1)

The method of claim 1, further comprising:
monitoring base tables related to the stored intermediate result set; and
marking the stored intermediate result set invalid if related base data are changed.

### Claim 7 (depends on 6)

The method of claim 6, further comprising: recalculating of the stored intermediate result set after it was marked invalid.

### Claim 8 (depends on 1)

The method of claim 1, wherein the determination of the value of the intermediate result set rating comprises a calculation of costs for generating the intermediate result set, wherein the costs are indicative of resource consumption for the generation of the intermediate result set.

### Claim 9 (depends on 1)

The method of claim 1, wherein the determination of the value of the intermediate result set rating comprises a calculation of a volume reduction of the intermediate result set in comparison to a related base data size.

### Claim 10 (depends on 1)

The method of claim 1, wherein the determination of the value of intermediate result set rating comprises a calculation of a reuse factor for the intermediate result set, wherein the reuse factor is indicative of a number of accesses to the intermediate result set in comparison to a total number of executed access plans in a predefined timeframe.

### Claim 11 (depends on 1)

The method of claim 1, wherein the determination of a value of the intermediate result set rating comprises a determination of an invalidation likelihood due to changes in underlying base data.

### Claim 12

A system comprising:
a receiving unit configured to receive an access plan for a single query for accessing data stored in the system;
a generating unit configured to generate an intermediate result set during execution of the access plan;
a determining unit configured to determine a value of an intermediate result set rating of the intermediate result set during execution of the access plan at runtime of the query for determining if the intermediate result set, generated during the execution of the access plan, is to be stored; and
a storage unit configured to store the determined intermediate result set for a longer period of time than the runtime of the query.

### Claim 13 (depends on 12)

The system of claim 12, wherein the system is configured to receive the access plan again and adapt dynamically the re-received access plan during the execution of the access plan, wherein the adaption is based on an existence of the stored intermediate result set.

### Claim 14 (depends on 12)

The system of claim 12, wherein the system is configured to receive a further access plan and adapt dynamically the further access plan during the execution of the further access plan based on an existence of the stored intermediate result set.

### Claim 15 (depends on 12)

The system of claim 12, wherein the system is configured to monitor base tables related to the stored intermediate result set, and mark the stored intermediate result set invalid if related base data are changed.

### Claim 16 (depends on 15)

The system of claim 15, wherein the system is configured to recalculate the stored intermediate result set after it was marked invalid.

### Claim 17 (depends on 12)

The system of claim 12, wherein the determination of the value of the intermediate result set rating comprises a calculation of costs for generating the intermediate result set, wherein the costs are indicative of resource consumption for the generation of the intermediate result set.

### Claim 18 (depends on 12)

The system of claim 12, wherein the determination of the value of the intermediate result set rating comprises a calculation of a volume reduction of the intermediate result set in comparison to a related base data size.

### Claim 19 (depends on 12)

The system of claim 12, wherein the determination of the value of intermediate result set rating comprises a calculation of a reuse factor for the intermediate result set, wherein the reuse factor is indicative of a number of accesses to the intermediate result set in comparison to a total number of executed access plans in a predefined timeframe.

### Claim 20

A computer program product for storing intermediate result sets in a database system, the computer program product comprising:
a computer readable storage medium having program code embodied therewith, the program code executable by a processor to:
receive an access plan for a single query for accessing data stored in the database system;
generate an intermediate result set during execution of the access plan;
determine a value of an intermediate result set rating of the intermediate result set during execution of the access plan at runtime of the query for determining if the intermediate result set, generated during the execution of the access plan, is to be stored; and
based on the determination that the value of the intermediate result set rating meets a predefined criterion, store the determined intermediate result set for a longer period of time than the runtime of the query as a stored intermediate result set.
