# US 12,602,369 B2 · Online, efficient and cost-optimized database index consistency checks

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

- Number: US 12,602,369 B2
- Document ID: US12602369B2
- Status: Granted
- Kind: B2
- Application number: 18/655,499
- Filed: 2024-05-06
- Published: 2025-11-06
- Granted: 2026-04-14
- Earliest claimed: 2024-05-06
- Assignees: Sap SE
- Applicants: Sap SE
- Inventors: Shu-mu Du; Wen-long Cao; Tianlun Chen; Hu Yin
- Web page: https://patentgrep.com/patent/US12602369B2

## CPC

- G06F 16/2365: {Ensuring data consistency and integrity}
- G06F 11/1402: {Saving, restoring, recovering or retrying}
- G06F 16/2255: {Hash tables}
- G06F 16/2272: {Management thereof}
- G06F 16/2379: {Updates performed during online database operations; commit processing}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Methods, systems, and computer-readable storage media for reading a page stored in a database system, each page storing rows of data, for a first index row of a first page, determining that the first index row is absent from being recorded in a hash table, and in response, storing a first record of the first index row in the hash table, the first record including a first hash value representative of the first index row, for a first data row of a second page, providing a second index row based on one or more values of one or more fields of the first data row, and determining that the second index row is recorded in the hash table as the first index row in the first record, and in response, removing the first record from the hash table, and outputting index consistency results based on the hash table.

## Claims

### Claim 1

A computer-implemented method for database consistency checks in database systems, the method being executed by one or more processors and comprising:
reading a page of a plurality of pages stored in a database system, each page storing rows of data;
for a first index row of a plurality of index rows of a first page of the plurality of pages, determining that the first index row is absent from being recorded in a multi-level hash table, and in response:
storing a first record of the first index row in the multi-level hash table, the first record comprising a first hash value representative of the first index row, the first hash value being determined through hashing using an object identifier that identifies a table and an index identifier that identifies an index of the table, the first hash value pointing to a second hash value determined through hashing a page identifier based on a bucket count;
for a first data row of a plurality of data rows of a second page of the plurality of pages:
providing a second index row based on one or more values of one or more fields of the first data row, and
determining that the second index row is recorded in the hash table as the first index row in the first record, and in response:
removing the first record from the hash table; and
outputting index consistency results based on the hash table.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
for a second data row of a plurality of data rows of the second page:
providing a third index row based on one or more values of one or more fields of the second data row, and in response:
storing a second record of the second data row in the hash table, the second record comprising a third hash value representative of the third index row.

### Claim 3 (depends on 1)

The method of claim 1, wherein the first record comprises a first-level hash key, a second-level hash key, and the first hash value.

### Claim 4 (depends on 1)

The method of claim 1, further comprising, prior to outputting the index consistency results, determining that at least one entry remains in the hash table after processing all pages of the plurality of pages, and in response:
executing a retry phase to remove the at least one entry from the hash table.

### Claim 5 (depends on 1)

The method of claim 1, wherein pages of the plurality of pages are read in allocation order as the pages are stored in computer-readable memory.

### Claim 6 (depends on 1)

The method of claim 1, wherein one of:
the index consistency results indicate that an index of the database is consistent in response to the hash table being absent entries after processing all pages in the plurality of pages; and
the index consistency results indicate that an index of the database is inconsistent in response to the hash table comprising at least one entry after processing all pages in the plurality of pages.

### Claim 7 (depends on 1)

The method of claim 1, wherein the first page comprises an index page and the second page comprises a data page.

### Claim 8

A non-transitory computer-readable storage medium coupled to one or more processors and having instructions stored thereon which, when executed by the one or more processors, cause the one or more processors to perform operations for database consistency checks in database systems, the operations comprising:
reading a page of a plurality of pages stored in a database system, each page storing rows of data;
for a first index row of a plurality of index rows of a first page of the plurality of pages, determining that the first index row is absent from being recorded in a hash table, and in response:
storing a first record of the first index row in the hash table, the first record comprising a first hash value representative of the first index row, the first hash value being determined through hashing using an object identifier that identifies a table and an index identifier that identifies an index of the table, the first hash value pointing to a second hash value determined through hashing a page identifier based on a bucket count;
for a first data row of a plurality of data rows of a second page of the plurality of pages:
providing a second index row based on one or more values of one or more fields of the first data row, and
determining that the second index row is recorded in the hash table as the first index row in the first record, and in response:
removing the first record from the hash table; and
outputting index consistency results based on the hash table.

### Claim 9 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein operations further comprise:
for a second data row of a plurality of data rows of the second page:
providing a third index row based on one or more values of one or more fields of the second data row, and in response:
storing a second record of the second data row in the hash table, the second record comprising a third hash value representative of the third index row.

### Claim 10 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein the first record comprises a first-level hash key, a second-level hash key, and the first hash value.

### Claim 11 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein operations further comprise, prior to outputting the index consistency results, determining that at least one entry remains in the hash table after processing all pages of the plurality of pages, and in response:
executing a retry phase to remove the at least one entry from the hash table.

### Claim 12 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein pages of the plurality of pages are read in allocation order as the pages are stored in computer-readable memory.

### Claim 13 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein one of:
the index consistency results indicate that an index of the database is consistent in response to the hash table being absent entries after processing all pages in the plurality of pages; and
the index consistency results indicate that an index of the database is inconsistent in response to the hash table comprising at least one entry after processing all pages in the plurality of pages.

### Claim 14 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein the first page comprises an index page and the second page comprises a data page.

### Claim 15

A system, comprising:
a computing device; and
a computer-readable storage device coupled to the computing device and having instructions stored thereon which, when executed by the computing device, cause the computing device to perform operations for database consistency checks in database systems, the operations comprising:
reading a page of a plurality of pages stored in a database system, each page storing rows of data;
for a first index row of a plurality of index rows of a first page of the plurality of pages, determining that the first index row is absent from being recorded in a hash table, and in response:
storing a first record of the first index row in the hash table, the first record comprising a first hash value representative of the first index row, the first hash value being determined through hashing using an object identifier that identifies a table and an index identifier that identifies an index of the table, the first hash value pointing to a second hash value determined through hashing a page identifier based on a bucket count;
for a first data row of a plurality of data rows of a second page of the plurality of pages:
providing a second index row based on one or more values of one or more fields of the first data row, and
determining that the second index row is recorded in the hash table as the first index row in the first record, and in response:
removing the first record from the hash table; and
outputting index consistency results based on the hash table.

### Claim 16 (depends on 15)

The system of claim 15, wherein operations further comprise:
for a second data row of a plurality of data rows of the second page:
providing a third index row based on one or more values of one or more fields of the second data row, and in response:
storing a second record of the second data row in the hash table, the second record comprising a second hash value representative of the third index row.

### Claim 17 (depends on 15)

The system of claim 15, wherein the first record comprises a first-level hash key, a second-level hash key, and the first hash value.

### Claim 18 (depends on 15)

The system of claim 15, wherein operations further comprise, prior to outputting the index consistency results, determining that at least one entry remains in the hash table after processing all pages of the plurality of pages, and in response:
executing a retry phase to remove the at least one entry from the hash table.

### Claim 19 (depends on 15)

The system of claim 15, wherein pages of the plurality of pages are read in allocation order as the pages are stored in computer-readable memory.

### Claim 20 (depends on 15)

The system of claim 15, wherein one of:
the index consistency results indicate that an index of the database is consistent in response to the hash table being absent entries after processing all pages in the plurality of pages; and
the index consistency results indicate that an index of the database is inconsistent in response to the hash table comprising at least one entry after processing all pages in the plurality of pages.
