# US 2017/0293653 A1 · Fair scheduling for mixed-query loads

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

- Number: US 2017/0293653 A1
- Document ID: US20170293653A1
- Status: Published application
- Kind: A1
- Application number: 15/634,422
- Filed: 2017-06-27
- Published: 2017-10-12
- Earliest claimed: 2013-03-14
- Assignees: Palantir Technologies Inc.
- Applicants: Palantir Technologies, Inc.
- Inventors: Michael Harris; John Carrino; Eric Wong
- Web page: https://patentgrep.com/patent/US20170293653A1

## CPC

- G06F 16/24535: {of sub-queries or views}
- G06F 16/2453: Query optimisation
- G06F 16/24542: {Plan optimisation}
- G06F 16/2455: Query execution
- G06F 16/951: Indexing; Web crawling techniques
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A fair scheduling system with methodology for scheduling queries for execution by a database management system in a fair manner. The system obtains query jobs for execution by the database management system and cost estimates to execute the query jobs. Based on the cost estimates, the system causes the database management system to execute the query jobs as separate sub-query tasks in a round-robin fashion. By doing so, the execution latency of low cost query jobs that return few results is reduced when the query jobs are concurrently executed with high cost query jobs that return many results.

## Claims

### Claim 1

A computing system, comprising:
one or more processors;
storage media;
one or more programs stored in the storage media and configured for execution by the one or more processors, the one or more programs comprising instructions configured for:
obtaining a query for execution by a database management system and a cost estimate for the database management system to execute the query;
enqueuing an item for the query onto a queue, the queue having a head, a tail, and a maximum number of allowed items;
based, at least in part, on the cost estimate, dividing the query into a plurality of sub-queries;
based, at least in part, on an item for the query reaching the head of the queue, causing a first sub-query of the plurality of sub-queries to be executed against the database management system; and
based, at least in part, on determining there are more sub-queries of the plurality of sub-queries to be executed against the database management system:
re-enqueuing an item for the query onto the tail of the queue if a current number of items in the queue is less than the maximum number of allowed items, or
waiting until a current number of items in the queue is less than the maximum number of allowed items before re-enqueuing an item for the query onto the tail of the queue if a current number of items in the queue is not less than the maximum number of allowed items.

### Claim 2 (depends on 1)

The computing system of claim 1, wherein the cost estimate is a number of query results the query is expected to return.

### Claim 3 (depends on 1)

The computing system of claim 1, the one or more programs comprising instructions configured for:
based, at least in part, on the determining there are more sub-queries of the plurality of sub-queries to be executed against the database management system, re-enqueuing an item for the query onto the tail of the queue.

### Claim 4 (depends on 1)

The computing system of claim 1, the one or more programs comprising instructions configured for:
based, at least in part, on the determining there are more sub-queries of the plurality of sub-queries to be executed against the database management system, waiting until a current number of items in the queue is less than the maximum number of allowed items before re-enqueuing an item for the query onto the tail of the queue.

### Claim 5 (depends on 1)

The computing system of claim 1, wherein the first sub-query is configured with a result limiter that limits a number of results the first sub-query returns.

### Claim 6 (depends on 1)

The computing system of claim 1, the one or more programs further comprising instructions configured for:
de-queueing an item for the query from the head of the queue; and
wherein the causing the first sub-query to be executed against the database management system is based, at least in part, on the de-queueing.

### Claim 7 (depends on 1)

The computing system of claim 1, the one or more programs further comprising instructions configured for:
based, at least in part, on determining there are no more sub-queries of the plurality of sub-queries to be executed against the database management system, not re-enqueuing an item for the query onto the tail of the queue.

### Claim 8

A method performed by a computing system comprising one or more processors, storage media, and one or more programs stored in the storage media and executed by the one or more processors to perform the method, the method comprising:
obtaining a query for execution by a database management system and a cost estimate for the database management system to execute the query;
enqueuing an item for the query onto a queue, the queue having a head, a tail, and a maximum number of allowed items;
based, at least in part, on the cost estimate, dividing the query into a plurality of sub-queries;
based, at least in part, on an item for the query reaching the head of the queue, causing a first sub-query of the plurality of sub-queries to be executed against the database management system; and
based, at least in part, on determining there are more sub-queries of the plurality of sub-queries to be executed against the database management system:
re-enqueuing an item for the query onto the tail of the queue if a current number of items in the queue is less than the maximum number of allowed items, or
waiting until a current number of items in the queue is less than the maximum number of allowed items before re-enqueuing an item for the query onto the tail of the queue if a current number of items in the queue is not less than the maximum number of allowed items.

### Claim 9 (depends on 8)

The method of claim 8, wherein the cost estimate is a number of query results the query is expected to return.

### Claim 10 (depends on 8)

The method of claim 8, further comprising:
based, at least in part, on the determining there are more sub-queries of the plurality of sub-queries to be executed against the database management system, re-enqueuing an item for the query onto the tail of the queue.

### Claim 11 (depends on 8)

The method of claim 8, further comprising:
based, at least in part, on the determining there are more sub-queries of the plurality of sub-queries to be executed against the database management system, waiting until a current number of items in the queue is less than the maximum number of allowed items before re-enqueuing an item for the query onto the tail of the queue.

### Claim 12 (depends on 8)

The method of claim 8, wherein the first sub-query is configured with a result limiter that limits a number of results the first sub-query returns.

### Claim 13 (depends on 8)

The method of claim 8, further comprising:
de-queueing an item for the query from the head of the queue; and
wherein the causing the first sub-query to be executed against the database management system is based, at least in part, on the de-queueing.

### Claim 14 (depends on 8)

The method of claim 8, further comprising:
based, at least in part, on determining there are no more sub-queries of the plurality of sub-queries to be executed against the database management system, not re-enqueuing an item for the query onto the tail of the queue.

### Claim 15

One or more non-transitory computer-readable media storing one or more one or more programs for execution by a computing system comprising one or more processors and storage media, the one or more programs comprising instructions configured for:
obtaining a query for execution by a database management system and a cost estimate for the database management system to execute the query;
enqueuing an item for the query onto a queue, the queue having a head, a tail, and a maximum number of allowed items;
based, at least in part, on the cost estimate, dividing the query into a plurality of sub-queries;
based, at least in part, on an item for the query reaching the head of the queue, causing a first sub-query of the plurality of sub-queries to be executed against the database management system; and
based, at least in part, on determining there are more sub-queries of the plurality of sub-queries to be executed against the database management system:
re-enqueuing an item for the query onto the tail of the queue if a current number of items in the queue is less than the maximum number of allowed items, or
waiting until a current number of items in the queue is less than the maximum number of allowed items before re-enqueuing an item for the query onto the tail of the queue if a current number of items in the queue is not less than the maximum number of allowed items.

### Claim 16 (depends on 15)

The one or more non-transitory computer-readable media of claim 15, wherein the cost estimate is a number of query results the query is expected to return.

### Claim 17 (depends on 15)

The one or more non-transitory computer-readable media of claim 15, the one or more programs comprising instructions configured for:
based, at least in part, on the determining there are more sub-queries of the plurality of sub-queries to be executed against the database management system, re-enqueuing an item for the query onto the tail of the queue.

### Claim 18 (depends on 15)

The one or more non-transitory computer-readable media of claim 15, the one or more programs comprising instructions configured for:
based, at least in part, on the determining there are more sub-queries of the plurality of sub-queries to be executed against the database management system, waiting until a current number of items in the queue is less than the maximum number of allowed items before re-enqueuing an item for the query onto the tail of the queue.

### Claim 19 (depends on 15)

The one or more non-transitory computer-readable media of claim 15, wherein the first sub-query is configured with a result limiter that limits a number of results the first sub-query returns.

### Claim 20 (depends on 15)

The one or more non-transitory computer-readable media of claim 15, the one or more programs further comprising instructions configured for:
de-queueing an item for the query from the head of the queue; and
wherein the causing the first sub-query to be executed against the database management system is based, at least in part, on the de-queueing.

### Claim 21 (depends on 15)

The one or more non-transitory computer-readable media of claim 15, the one or more programs further comprising instructions configured for:
based, at least in part, on determining there are no more sub-queries of the plurality of sub-queries to be executed against the database management system, not re-enqueuing an item for the query onto the tail of the queue.
