# US 9,519,649 B2 · Free space management in a database

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

- Number: US 9,519,649 B2
- Document ID: US9519649B2
- Status: Granted
- Kind: B2
- Application number: 14/047,992
- Filed: 2013-10-07
- Published: 2015-04-09
- Granted: 2016-12-13
- Earliest claimed: 2013-10-07
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Charles R. Bonner; John J. Campbell; Frances H. Villafuerte; Maryela E. Weihrauch
- Web page: https://patentgrep.com/patent/US9519649B2

## CPC

- G06F 16/2282: {Tablespace storage structures; Management thereof}
- G06F 16/1727: {Details of free space management performed by the file system (saving storage space on storage systems G06F3/0608; management of blocks in storage devices G06F3/064)}
- G06F 16/23: Updating
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A row is inserted in a database table on a page having a first space reserved for inserting rows of the database table. A second space is reserved for adding data to the inserted row, wherein reserving the second space includes reserving the second space on the page responsive to inserting the row.

## Claims

### Claim 1

A method for allocating space in a database, the method comprising:
inserting, by a computer processor, a row in a database table on a page having a first space reserved for inserting rows of the database table;
reserving, by a computer processor, a second space for adding data to the inserted row, wherein reserving the second space includes reserving the second space on the page responsive to inserting the row, so that the amount of space reserved for adding data to inserted rows grows as more rows are inserted; and
gathering real time statistics for reserving the second space on a dynamic basis, including gathering statistics indicating a first count of how many of an UPDATE operation changed data of rows of the database table and a second count of how many of an INSERT operation inserted new rows in the database table and wherein reserving the second space for adding data to the inserted row includes reserving the second space responsive to a ratio of the first and second counts.

### Claim 2 (depends on 1)

The method of claim 1, wherein reserving the second space for adding data to the inserted row includes reserving the second space for the inserted row responsive to real time statistics gathered between operations that reorganize layout of the rows of the database table.

### Claim 3 (depends on 1)

The method of claim 1, comprising:
marking the page full for the second space independently of whether the first space is full for inserting new rows, wherein responsive to detecting that the second space is full, the method includes adding data to rows on the page by adding the data to one or more new pages, even though rows may still be inserted on the page using any remaining room in the first space on the page.

### Claim 4 (depends on 1)

The method of claim 1, wherein reserving the second space for adding data to the inserted row includes reserving the second space in the first space.

### Claim 5

A computer program product for allocating free space in a database program, the computer program product including a computer readable storage medium having instructions stored thereon for execution by a computer system, wherein the instructions, when executed by the computer system, cause the computer system to implement a method comprising:
inserting a row in a database table on a page having a first space reserved for inserting rows of the database table;
reserving a second space for adding data to the inserted row, wherein reserving the second space includes reserving the second space on the page responsive to inserting the row, so that the amount of space reserved for adding data to inserted rows grows as more rows are inserted; and
gathering real time statistics for reserving the second space on a dynamic basis, including gathering statistics indicating a first count of how many of an UPDATE operation changed data of rows of the database table and a second count of how many of an INSERT operation inserted new rows in the database table and wherein reserving the second space for adding data to the inserted row includes reserving the second space responsive to a ratio of the first and second counts.

### Claim 6 (depends on 5)

The computer program product of claim 5, wherein reserving the second space for adding data to the inserted row includes reserving the second space for the inserted row responsive to real time statistics gathered between operations that reorganize layout of the rows of the database table.

### Claim 7 (depends on 5)

The computer program products of claim 5, wherein the instructions, when executed by the computer system, cause the computer system to implement a method further comprising:
marking the page full for the second space independently of whether the first space is full for inserting new rows, wherein responsive to detecting that the second space is full, the method includes adding data to rows on the page by adding the data to one or more new pages, even though rows may still be inserted on the page using any remaining room in the first space on the page.

### Claim 8 (depends on 5)

The computer program product of claim 5, wherein reserving the second space for adding data to the inserted row includes reserving the second space in the first space.

### Claim 9

A system for allocating free space in a database program, the system comprising:
a processor; and
a computer readable storage medium connected to the processor, wherein the computer readable storage medium has stored thereon a program for controlling the processor, and wherein the processor is operative with the program to execute the program for:
inserting a row in a database table on a page having a first space reserved for inserting rows of the database table;
reserving a second space for adding data to the inserted row, wherein reserving the second space includes reserving the second space on the page responsive to inserting the row, so that the amount of space reserved for adding data to inserted rows grows as more rows are inserted; and
gathering real time statistics for reserving the second space on a dynamic basis, including gathering statistics indicating a first count of how many of an UPDATE operation changed data of rows of the database table and a second count of how many of an INSERT operation inserted new rows in the database table and wherein reserving the second space for adding data to the inserted row includes reserving the second space responsive to a ratio of the first and second counts.

### Claim 10 (depends on 9)

The system of claim 9, wherein reserving the second space for adding data to the inserted row includes reserving the second space for the inserted row responsive to real time statistics gathered between operations that reorganize layout of the rows of the database table.

### Claim 11 (depends on 9)

The system of claim 9, wherein the processor is further operative with the program to execute the program for:
marking the page full for the second space independently of whether the first space is full for inserting new rows, wherein responsive to detecting that the second space is full, the method includes adding data to rows on the page by adding the data to one or more new pages, even though rows may still be inserted on the page using any remaining room in the first space on the page.

### Claim 12 (depends on 9)

The system of claim 9, wherein reserving the second space for adding data to the inserted row includes reserving the second space in the first space.
