# US 2024/0176781 A1 · Speculative execution for regular expressions

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

- Number: US 2024/0176781 A1
- Document ID: US20240176781A1
- Status: Published application
- Kind: A1
- Application number: 18/070,751
- Filed: 2022-11-29
- Published: 2024-05-30
- Earliest claimed: 2022-11-29
- Applicants: Oracle International Corporation
- Inventors: GIACOMO FABRIS; ALEKSEI KASHUBA; ALEXANDER ULRICH; JOSEF HAIDER; CHRISTIAN WIRTH
- Web page: https://patentgrep.com/patent/US20240176781A1

## CPC

- G06F 16/24542: {Plan optimisation}
- G06F 11/349: {for interfaces, buses}
- G06F 16/24537: {of operators}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques are described to improve the performance of regular expression (regex) evaluation in a database management system (DBMS) by a speculative execution of a regex engine. In an embodiment, the DBMS determines properties of strings and generates descriptors for the string input data. Based on the descriptors, the regex engine validates an existing assertion for the execution logic to, at least in part, evaluate the regex pattern on the strings. Based on validating the existing assertion for selecting the execution logic, evaluating the regex pattern on the strings.

## Claims

### Claim 1

A computer-implemented method comprising:
receiving first string input data and first regex pattern data, the first string input data indicating one or more first strings with which a first regex pattern, of the first regex pattern data, is to be matched;
determining one or more properties of the one or more strings of the first string input data;
based on the one or more properties of the first string input data, generating one or more first descriptors for the first string input data;
based on the one or more first descriptors, validating a particular existing assertion for selection of a first execution logic from a plurality of alternative execution logics to, at least in part, evaluate the first regex pattern on the one or more first strings by a particular regex engine that includes the plurality of alternative execution logics;
loading the first execution logic for evaluating the first regex pattern on the one or more first strings;
based on validating the particular existing assertion for selecting the first execution logic, evaluating the first regex pattern on the one or more first strings to yield result data of matching the first regex pattern to the one or more first strings using, at least in part, the first execution logic from the plurality of alternative execution logics of the particular regex engine.

### Claim 2 (depends on 1)

The method of claim 1, wherein the first execution logic for evaluating the first regex pattern on the one or more first strings is optimized machine code.

### Claim 3 (depends on 1)

The method of claim 1, wherein the one or more first descriptors describe at least one of: a character set for the one or more first strings, a data type of the one or more first strings, or a data access type for the one or more first strings.

### Claim 4 (depends on 1)

The method of claim 1, wherein the first execution logic of the plurality of alternative execution logics corresponds to an optimization based, at least in part on, the one of the one or more properties of the one or more first strings, and a second execution logic of the plurality of alternative execution logics corresponds to having no optimization based, at least in part on, of the one or more properties of the one or more first strings.

### Claim 5 (depends on 1)

The method of claim 1, wherein the first regex pattern data indicates an automaton for the first regex pattern, a finite state machine with the final state of the finite state machine indicating a match of the first regex pattern.

### Claim 6 (depends on 1)

The method of claim 1, further comprising:
receiving a first query, the first query including a request to evaluate the first regex pattern;
querying a regex object store to determine whether an automaton object corresponding to the first regex pattern exists, wherein the automaton object corresponds to an automaton, a finite state machine, with the final state of the finite state machine indicating a match of the first regex pattern;
if determined that no automaton object exists, generating the automaton object at least by parsing the first regex pattern;
receiving the first regex pattern data corresponding to the automaton object for the first regex pattern.

### Claim 7 (depends on 1)

The method of claim 1, further comprising:
receiving second string input data, different from the first string input data, and second regex pattern data, the second string input data indicating one or more second strings, different from the one or more first strings, with which a second regex pattern, of the second regex pattern data, is to be matched;
based on the one or more properties of the second string input data, generating one or more second descriptors for processing the second string input data by the particular regex engine that includes the plurality of alternative execution logics;
based on the one or more second descriptors, validating the particular existing assertion for selection of the first execution logic from the plurality of alternative execution logics to, at least in part, evaluate the second regex pattern on the one or more second strings;
based on validating the particular existing assertion for selecting the first execution logic and without loading a different execution logic of the plurality of alternative execution logics, evaluating the second regex pattern on the one or more second strings to yield the result data of matching the second regex pattern to the one or more second strings using, at least in part, the first execution logic from the plurality of alternative execution logics of the particular regex engine.

### Claim 8 (depends on 1)

The method of claim 1, further comprising:
receiving second string input data, different from the first string input data, and second regex pattern data, the second string input data indicating one or more second strings, different from the one or more first strings, with which a second regex pattern, of the second regex pattern data, is to be matched;
based on the one or more properties of the second string input data, generating one or more second descriptors for processing the second string input data by the particular regex engine that includes the plurality of alternative execution logics;
based on the one or more second descriptors, invalidating the particular existing assertion for selection of the first execution logic from the plurality of alternative execution logics to, at least in part, evaluate the second regex pattern on the one or more second strings;
based on invalidating the particular existing assertion for selecting the first execution logic, evaluating the second regex pattern on the one or more second strings to yield the result data of matching the second regex pattern to the one or more second strings using, at least in part, a second execution logic, different from the first execution logic, from the plurality of alternative execution logics of the particular regex engine.

### Claim 9 (depends on 8)

The method of claim 8, further comprising:
based on invalidating the particular existing assertion for selecting the first execution logic, loading the second execution logic for evaluating the second regex pattern on the one or more second strings.

### Claim 10 (depends on 1)

The method of claim 1, further comprising:
determining whether using the particular regex engine that includes the plurality of alternative execution logics to evaluate the first regex pattern on the one or more first strings consumes less computing resources than evaluating the first regex pattern on the one or more first strings by a different regex engine that does not include the plurality of alternative execution logics;
based on determining that using the particular regex engine that includes the plurality of alternative execution logics to evaluate the first regex pattern on the one or more first strings consumes less computing resources, evaluating, using the particular regex engine, the first regex pattern on the one or more first strings to yield the result data of matching the first regex pattern to the one or more first strings.

### Claim 11 (depends on 10)

The method of claim 10, wherein determining that using the particular regex engine that includes the plurality of alternative execution logics to evaluate the first regex pattern on the one or more first strings consumes less resources is based on an estimated size of the first string input data, computing resources available for the particular regex engine, or a complexity of the first regex pattern.

### Claim 12

One or more non-transitory computer-readable media storing a set of instructions, wherein the set of instructions includes instructions, which when executed by one or more hardware processors, cause:
receiving first string input data and first regex pattern data, the first string input data indicating one or more first strings with which a first regex pattern, of the first regex pattern data, is to be matched;
determining one or more properties of the one or more strings of the first string input data;
based on the one or more properties of the first string input data, generating one or more first descriptors for the first string input data;
based on the one or more first descriptors, validating a particular existing assertion for selection of a first execution logic from a plurality of alternative execution logics to, at least in part, evaluate the first regex pattern on the one or more first strings by a particular regex engine that includes the plurality of alternative execution logics;
loading the first execution logic for evaluating the first regex pattern on the one or more first strings;
based on validating the particular existing assertion for selecting the first execution logic, evaluating the first regex pattern on the one or more first strings to yield result data of matching the first regex pattern to the one or more first strings using, at least in part, the first execution logic from the plurality of alternative execution logics of the particular regex engine.

### Claim 13 (depends on 12)

The one or more non-transitory computer-readable media of claim 12, wherein the first execution logic for evaluating the first regex pattern on the one or more first strings is optimized machine code.

### Claim 14 (depends on 12)

The one or more non-transitory computer-readable media of claim 12, wherein the one or more first descriptors describe at least one of: a character set for the one or more first strings, a data type of the one or more first strings, or a data access type for the one or more first strings.

### Claim 15 (depends on 12)

The one or more non-transitory computer-readable media of claim 12, wherein the first execution logic of the plurality of alternative execution logics corresponds to an optimization based, at least in part on, the one of the one or more properties of the one or more first strings, and a second execution logic of the plurality of alternative execution logics corresponds to having no optimization based, at least in part on, of the one or more properties of the one or more first strings.

### Claim 16 (depends on 12)

The one or more non-transitory computer-readable media of claim 12, wherein the first regex pattern data indicates an automaton for the first regex pattern, a finite state machine with the final state of the finite state machine indicating a match of the first regex pattern.

### Claim 17 (depends on 12)

The one or more non-transitory computer-readable media of claim 12, wherein the set of instructions further includes instructions, which, when executed by said one or more hardware processors, cause:
receiving a first query, the first query including a request to evaluate the first regex pattern;
querying a regex object store to determine whether an automaton object corresponding to the first regex pattern exists, wherein the automaton object corresponds to an automaton, a finite state machine, with the final state of the finite state machine indicating a match of the first regex pattern;
if determined that no automaton object exists, generating the automaton object at least by parsing the first regex pattern;
receiving the first regex pattern data corresponding to the automaton object for the first regex pattern.

### Claim 18 (depends on 12)

The one or more non-transitory computer-readable media of claim 12, wherein the set of instructions further includes instructions, which, when executed by said one or more hardware processors, cause:
receiving second string input data, different from the first string input data, and second regex pattern data, the second string input data indicating one or more second strings, different from the one or more first strings, with which a second regex pattern, of the second regex pattern data, is to be matched;
based on the one or more properties of the second string input data, generating one or more second descriptors for processing the second string input data by the particular regex engine that includes the plurality of alternative execution logics;
based on the one or more second descriptors, validating the particular existing assertion for selection of the first execution logic from the plurality of alternative execution logics to, at least in part, evaluate the second regex pattern on the one or more second strings;
based on validating the particular existing assertion for selecting the first execution logic and without loading a different execution logic of the plurality of alternative execution logics, evaluating the second regex pattern on the one or more second strings to yield the result data of matching the second regex pattern to the one or more second strings using, at least in part, the first execution logic from the plurality of alternative execution logics of the particular regex engine.

### Claim 19 (depends on 12)

The one or more non-transitory computer-readable media of claim 12, wherein the set of instructions further includes instructions, which, when executed by said one or more hardware processors, cause:
receiving second string input data, different from the first string input data, and second regex pattern data, the second string input data indicating one or more second strings, different from the one or more first strings, with which a second regex pattern, of the second regex pattern data, is to be matched;
based on the one or more properties of the second string input data, generating one or more second descriptors for processing the second string input data by the particular regex engine that includes the plurality of alternative execution logics;
based on the one or more second descriptors, invalidating the particular existing assertion for selection of the first execution logic from the plurality of alternative execution logics to, at least in part, evaluate the second regex pattern on the one or more second strings;
based on invalidating the particular existing assertion for selecting the first execution logic, evaluating the second regex pattern on the one or more second strings to yield the result data of matching the second regex pattern to the one or more second strings using, at least in part, a second execution logic, different from the first execution logic, from the plurality of alternative execution logics of the particular regex engine.

### Claim 20 (depends on 12)

The one or more non-transitory computer-readable media of claim 12, wherein the set of instructions further includes instructions, which, when executed by said one or more hardware processors, cause:
determining whether using the particular regex engine that includes the plurality of alternative execution logics to evaluate the first regex pattern on the one or more first strings consumes less computing resources than evaluating the first regex pattern on the one or more first strings by a different regex engine that does not include the plurality of alternative execution logics;
based on determining that using the particular regex engine that includes the plurality of alternative execution logics to evaluate the first regex pattern on the one or more first strings consumes less computing resources, evaluating, using the particular regex engine, the first regex pattern on the one or more first strings to yield the result data of matching the first regex pattern to the one or more first strings.
