# US 9,355,129 B2 · Scheduling queries using a stretch metric

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

- Number: US 9,355,129 B2
- Document ID: US9355129B2
- Status: Granted
- Kind: B2
- Application number: 12/250,881
- Filed: 2008-10-14
- Published: 2010-04-15
- Granted: 2016-05-31
- Earliest claimed: 2008-10-14
- Assignees: Hewlett Packard Enterprise Development LP
- Applicants: Chetan Kumar Gupta; Song Wang; Abhay Mehta
- Inventors: Chetan Kumar Gupta; Song Wang; Abhay Mehta
- Web page: https://patentgrep.com/patent/US9355129B2

## CPC

- G06F 16/217: {Database tuning (G06F16/2282 takes precedence; database performance monitoring G06F11/3409)}
- G06F 16/2453: Query optimisation
- G06F 16/24534: {Query rewriting; Transformation}
- G06F 16/2457: with adaptation to user needs
- G06F 16/2462: {Approximate or statistical queries}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A query scheduler orders queries in a queue. Each query is executed based on its position in the queue. When a new query is received, the new query is inserted in the queue. A position in the queue for inserting the new query is determined based on a stretch metric for each query in the queue.

## Claims

### Claim 1

A method for scheduling queries, the method comprising:
maintaining a queue of queries, the queue identifying an order for executing the queries;
receiving a new query;
determining, for the new query and for each of the queries in the queue, a stretch metric indicative of a Quality of Service (QoS) measure, wherein the stretch metric for each of the queries is based on an end time of the query, an arrival time of the query, and the processing time of the query;
minimizing an Ip norm of the stretch metric for at least some of the queries in the queue, wherein p is a finite, real number greater than 1;
determining, by a processor, a weight for the new query and a weight for each of the queries in the queue, wherein the weight for a query is based on the stretch metric of the query, and wherein the weight of a largest query in the queue is determined to be a largest weight only if such determination does not cause the stretch metric of the smallest query in the queue to exceed a predetermined threshold wait time;
determining, by the processor, a position in the queue to insert the new query by comparing the weight of the new query to the weights of the queries in the queue;
inserting the new query in the determined position in the queue; and
selecting a query from the queue to execute based on the order for executing the queries identified from the queue, wherein the query with the largest weight is executed first.

### Claim 2 (depends on 1)

The method of claim 1, wherein the queries are inserted into the queue based on an order of their weights.

### Claim 3 (depends on 2)

The method of claim 2, wherein the weights are ordered from highest to lowest in the queue and the new query is positioned in the queue between all weights greater than the new query's weight and all weights less than the new query's weight.

### Claim 4 (depends on 1)

The method of claim 1, wherein a highest weight for any query in the queue is 1, where a query in the queue with a highest weight is executed first.

### Claim 5 (depends on 4)

The method of claim 4, wherein a longest a query in the queue has to wait before its weight becomes 1 is:
1/p+Cw=1, where
w=(1/C)(1−1/p), and
p is the processing time, C is a constant and w is the wait time.

### Claim 6 (depends on 1)

The method of claim 1, wherein a weight function used to determine the weights of the queries is from a weight family characterized by:
f=C1/p+C2wk
where, C1 and C2>0, and k, C1 and C2 are constants, p is the processing time of the query, and w is the wait time.

### Claim 7 (depends on 6)

The method of claim 6, further comprising:
selecting values for C1 and C2 such that the queue represents more closely a shortest job first queue rather than a first-in-first-out queue, and such that starvation is avoided for queries having large execution times.

### Claim 8

At least one non-transitory computer readable medium storing instructions that when executed by a computer system cause the computer system to:
maintain a queue of queries, the queue identifying an order for executing the queries;
receive a new query;
determine, for the new query and for each of the queries in the queue, a stretch metric indicative of a Quality of Service (QoS) measure, wherein the stretch metric for each of the queries is based on an end time of the query, an arrival time of the query, and the processing time of the query;
minimize an Ip norm of the stretch metric for at least some of the queries in the queue, wherein p is a finite, real number greater than 1;
determine a weight for the new query and a weight for each of the queries in the queue, wherein the weight for a query is based on the stretch metric of the query, and wherein the weight of a largest query in the queue is determined to be a largest weight only if such determination does not cause the stretch metric of the smallest query in the queue to exceed a predetermined threshold wait time;
determine a position in the queue to insert the new query by comparing the weight of the new query to the weights of the queries in the queue;
insert the new query in the determined position in the queue; and
select a query from the queue to execute based on the order for executing the queries identified from the queue, wherein the query with the largest weight is executed first.

### Claim 9 (depends on 8)

The at least one non-transitory computer readable medium of claim 8, wherein the queries are inserted into the queue based on an order of their weights.

### Claim 10 (depends on 8)

The at least one non-transitory computer readable medium of claim 8, wherein a highest weight for any query in the queue is 1, where a query in the queue with a highest weight is executed first.

### Claim 11 (depends on 10)

The at least one non-transitory computer readable medium of claim 10, wherein a longest a query in the queue has to wait before its weight becomes 1 is:
1/p+Cw=1, where
w=(1/C)(1−1/p), and
p is the processing time, C is a constant and w is the wait time.

### Claim 12 (depends on 8)

The at least one non-transitory computer readable medium of claim 8, wherein a weight function used to determine the weights of the queries is from a weight family characterized by:
f=C1/p+C2wk
where, C1 and C2>0, and k, C1 and C2 are constants, p is the processing time of the query, and w is the wait time.

### Claim 13 (depends on 12)

The at least one non-transitory computer readable medium of claim 12, storing instructions to select values for C1 and C2 such that the queue represents more closely a shortest job first queue rather than a first-in-first-out queue, and such that starvation is avoided for queries having large execution times.

### Claim 14

A system comprising:
a processor; and
a non-transitory computer readable medium storing instructions that when executed by the processor cause the processor to implement an opportunistic query scheduling scheme to:
maintain a queue of queries, the queue identifying an order for executing the queries;
receive a new query;
determine, for the new query and for each of the queries in the queue, a stretch metric indicative of a Quality of Service (QoS) measure, wherein the stretch metric for each of the queries is based on an end time of the query, an arrival time of the query, and the processing time of the query;
minimize an Ip norm of the stretch metric for at least some of the queries in the queue, wherein p is a finite, real number greater than 1;
determine a weight for the new query and a weight for each of the queries in the queue, wherein the weight for a query is based on the stretch metric of the query, and wherein the weight of a largest query in the queue is determined to be a largest weight only if such determination does not cause the stretch metric of the smallest query in the queue to exceed a predetermined threshold wait time;
determine a position in the queue to insert the new query by comparing the weight of the new query to the weights of the queries in the queue;
insert the new query in the determined position in the queue; and
select a query from the queue to execute based on the order for executing the queries identified from the queue, wherein the query with the largest weight is executed first.

### Claim 15 (depends on 14)

The system of claim 14, wherein minimizing the Ip norm of the stretch metric comprises minimizing an I2 norm or an I3 norm of the stretch metric.

### Claim 16 (depends on 14)

The system of claim 14, wherein a highest weight for any query in the queue is 1, where a query in the queue with a highest weight is executed first.

### Claim 17 (depends on 16)

The system of claim 16, wherein a longest a query in the queue has to wait before its weight becomes 1 is:
1/p+Cw=1, where
w=(1/C)(1−1/p), and
p is the processing time, C is a constant and w is the wait time.

### Claim 18 (depends on 14)

The system of claim 14, wherein a weight function used to determine the weights of the queries is from a weight family characterized by:
f=C1/p+C2wk
where, C1 and C2>0, and k, C1 and C2 are constants, p is the processing time of the query, and w is the wait time.

### Claim 19 (depends on 18)

The system of claim 18, further comprising:
selecting values for C1 and C2 such that the queue represents more closely a shortest job first queue rather than a first-in-first-out queue, and such that starvation is avoided for queries having large execution times.
