# US 2013/0159279 A1 · Method For Monitoring And Controlling The Processing Of Database Searches

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

- Number: US 2013/0159279 A1
- Document ID: US20130159279A1
- Status: Published application
- Kind: A1
- Application number: 13/554,997
- Filed: 2012-07-20
- Published: 2013-06-20
- Earliest claimed: 2008-10-31
- Assignees: salesforce.com, inc.
- Inventors: Lars Hofhansl; Steven Tamm
- Web page: https://patentgrep.com/patent/US20130159279A1

## CPC

- G06F 16/2453: Query optimisation
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Systems, methods, and apparatus for preventing misuse of searches of a database system are provided. This prevention of misuse of database searches can enable reliable operation of the database system, as an improper query using a regular expression will not shut down or severely affect an application process that provides access to the database system. A thread of the application process determines whether an input character characters string matches the regular expression. To prevent misuse, a computational effort of the search is tracked, and compared to a threshold value. When the threshold is exceeded, an operation of the thread is exited or stopped.

## Claims

### Claim 1

A method for preventing misuse of database searches, the method comprising:
receiving a regular expression in a search and error handling thread of an application process running on a processor, wherein the regular expression includes one or more tokens and one or more quantifiers;
searching a database to find one or more input character strings that match the regular expression, wherein a duration of the searching scales greater than linearly with a size of an input character string in order to guarantee a determination of whether an input character string matches the regular expression including the quantifiers;
tracking, within the search and error handling thread, an amount of time of the searching for matches to the regular expression;
comparing the tracked amount of time to a threshold value; and
performing an internal exit in the search and error handling thread when the amount of time exceeds the threshold value prior to completion of the searching of the database.

### Claim 2 (depends on 1)

The method of claim 1, wherein tracking an amount of time of searching for matches to the regular expression includes periodically calling a subroutine that returns a time.

### Claim 3 (depends on 1)

The method of claim 1, wherein the searching uses backtracking.

### Claim 4 (depends on 1)

The method of claim 1, wherein the internal exit is from a routine of the search and error handling thread that performs the searching of the database.

### Claim 5 (depends on 1)

The method of claim 1, wherein the internal exit is from a loop that is performing a determination of whether a particular input character string matches the regular expression.

### Claim 6 (depends on 5)

The method of claim 5, further comprising stopping the searching the database to find an input character string that matches the received regular expression as a result of the internal exit.

### Claim 7 (depends on 1)

The method of claim 1, wherein the threshold value is the maximum allowed elapsed time since a prior event.

### Claim 8 (depends on 1)

The method of claim 1, wherein the threshold value scales superlinearly with the size of the input character string.

### Claim 9 (depends on 8)

The method of claim 8, wherein the size of the input character string is the number of characters in the input character string.

### Claim 10 (depends on 8)

The method of claim 8, wherein the size of the input character string is the amount of memory that is used to store the input character string.

### Claim 11 (depends on 1)

The method of claim 1, further including sending an exit message to a user if the amount of time exceeds the threshold value prior to completion of the searching of the database.

### Claim 12

A database system comprising:
an input interface for receiving a regular expression from a user;
logic that runs a search and error handling thread of an application process on a processor, wherein the search and error handling thread is configured to:
receive a regular expression in a search and error handling thread of an application process running on a processor, wherein the regular expression includes one or more tokens and one or more quantifiers;
search a database to find one or more input character strings that match the regular expression, wherein a duration of the searching scales greater than linearly with a size of an input character string in order to guarantee a determination of whether an input character string matches the regular expression including the quantifiers;
track, within the search and error handling thread, an amount of time of searching for matches to the regular expression, wherein the tracking of the amount of time occurs during the searching of the database to find the one or more input character strings that match the regular expression;
compare the amount of time to a threshold value; and
perform an internal exit in the search and error handling thread when the amount of time exceeds the threshold value prior to completion of the searching of the database.

### Claim 13 (depends on 12)

The database system of claim 12, wherein the tracking of an amount of time of searching for matches to the regular expression includes periodically calling a subroutine that returns a time.

### Claim 14 (depends on 12)

The database system of claim 12, wherein the search uses backtracking.

### Claim 15 (depends on 12)

The database system of claim 12, wherein the internal exit is from a routine of the search and error handling thread that performs the search of the database.

### Claim 16 (depends on 12)

The database system of claim 12, wherein the internal exist is from a loop that is performing a determination of whether a particular input character string matches the regular expression.

### Claim 17 (depends on 16)

The database system of claim 16, further comprising stopping the searching the database to find an input character string that matches the received regular expression as a result of the internal exit.

### Claim 18 (depends on 12)

The database system of claim 12, wherein the threshold value is the maximum allowed elapsed time since a prior event.

### Claim 19 (depends on 12)

The database system of claim 12, wherein the threshold value scales superlinearly with the size of the input character string.

### Claim 20 (depends on 19)

The database system of claim 19, wherein the size of the input character string is the number of characters in the input character string.

### Claim 21 (depends on 19)

The database system of claim 19, wherein the size of the input character string is the amount of memory that is used to store the input character string.

### Claim 22 (depends on 12)

The database system of claim 12, wherein the logic is further configured to send an exit message to a user if the amount of time exceeds the threshold value prior to completion of the searching of the database.
