Priority queue using two differently-indexed single-index tables
First Claim
Patent Images
1. A system, comprising:
- one or more hardware computing devices configured to;
in response to a request to generate an instance of a priority queue using a provisioned-input-output (provisioned-I/O) database that permits no more than one index per database table, configure an identifier-indexed table and a priority-indexed table in the database, wherein each queue entry of the instance is represented by a pair of tuples comprising a tuple in the identifier-indexed table and a tuple in the priority-indexed table;
in response to a request to insert a queue entry into the instance, insert one tuple with a corresponding identifier into the identifier-indexed table and one tuple with the corresponding identifier into the priority-indexed table; and
in response to a request to remove a queue entry with a specified identifier from the instance,identify, using an index lookup of the specified identifier, a first target tuple to be removed from the identifier-indexed table;
remove the first target tuple from the identifier-indexed table; and
defer a removal of a second target tuple from the priority-indexed table until, in response to a request to retrieve an identifier of a queue entry based at least in part on a priority criterion, a determination is made that the first target tuple has been removed from the identifier-indexed table.
1 Assignment
0 Petitions
Accused Products
Abstract
Methods and apparatus for efficient priority queues using single-index tables are disclosed. In response to a request to generate an instance of a priority queue using a database that permits no more than one index per table, an identifier-indexed table and a priority-indexed table are set up. In response to a request to insert a queue entry with a given identifier and a given priority, one tuple is inserted into each table. In response to a request to remove an entry with a specified identifier, a tuple with the specified identifier is removed from the identifier-indexed table, while the removal of the corresponding tuple from the priority-indexed table may be deferred.
24 Citations
21 Claims
-
1. A system, comprising:
one or more hardware computing devices configured to; in response to a request to generate an instance of a priority queue using a provisioned-input-output (provisioned-I/O) database that permits no more than one index per database table, configure an identifier-indexed table and a priority-indexed table in the database, wherein each queue entry of the instance is represented by a pair of tuples comprising a tuple in the identifier-indexed table and a tuple in the priority-indexed table; in response to a request to insert a queue entry into the instance, insert one tuple with a corresponding identifier into the identifier-indexed table and one tuple with the corresponding identifier into the priority-indexed table; and in response to a request to remove a queue entry with a specified identifier from the instance, identify, using an index lookup of the specified identifier, a first target tuple to be removed from the identifier-indexed table; remove the first target tuple from the identifier-indexed table; and defer a removal of a second target tuple from the priority-indexed table until, in response to a request to retrieve an identifier of a queue entry based at least in part on a priority criterion, a determination is made that the first target tuple has been removed from the identifier-indexed table. - View Dependent Claims (2, 3, 4, 5, 6)
-
7. A method, comprising:
-
configuring, in response to a request to generate an instance of a priority queue using a database that permits no more than one index per database table, an identifier-indexed table and a priority-indexed table in the database, wherein each queue entry of the instance is represented by a pair of tuples comprising a tuple in the identifier-indexed table and a tuple in the priority-indexed table; in response to a request to insert a queue entry into the instance, inserting one tuple with a corresponding identifier into the identifier-indexed table and one tuple with the corresponding identifier into the priority-indexed table; and in response to a request to remove a queue entry with a specified identifier from the instance, identifying, using the specified identifier, a first target tuple to be removed from the identifier-indexed table; and removing the first target tuple from the identifier-indexed table; wherein a removal of a second target tuple corresponding to the queue entry from the priority-indexed table is deferred until, in response to a request to retrieve an identifier of a queue entry based at least in part on a priority criterion, a determination is made that the first target tuple has been removed from the identifier-indexed table. - View Dependent Claims (8, 9, 10, 11, 12, 13)
-
-
14. A method, comprising:
-
configuring, in response to a request to generate an instance of a priority queue using a database that permits no more than one index per database table, an identifier-indexed table and a priority-indexed table in the database, wherein each queue entry of the instance is represented by a pair of tuples comprising a tuple in the identifier-indexed table and a tuple in the priority-indexed table; in response to a request to insert a queue entry into the instance, inserting one tuple with a corresponding identifier into the identifier-indexed table and one tuple with the corresponding identifier into the priority-indexed table; and in response to a request to remove a queue entry with a specified identifier from the instance, identifying, using the specified identifier, a first target tuple to be removed from the identifier-indexed table; determining, using contents of the first target tuple, a priority value usable for an index-based lookup of a second target tuple to be removed from the priority-indexed table; and removing the first target tuple from the identifier-indexed table and the second target tuple from the priority-indexed table.
-
-
15. A non-transitory computer-accessible storage medium storing program instructions that when executed on one or more processors implement a priority queue service configured to:
-
in response to a request to establish a priority queue instance, configure an identifier-indexed table and a priority-indexed table in a database, wherein each queue entry of the instance is represented by a pair of tuples comprising a tuple with a corresponding identifier in the identifier-indexed table and a tuple with the corresponding identifier in the priority-indexed table; and in response to a request to remove a queue entry with a specified identifier from the instance, identify, using the specified identifier, a first target tuple to be removed from the identifier-indexed table; in response to determining that contents of the first target tuple can be used to access, using an index lookup, a second target tuple to be deleted from the priority-indexed table, remove the first target tuple from the identifier-indexed table and the second target tuple from the priority-indexed table; and in response to determining that contents of the first target tuple cannot be used to access the second target tuple using an index lookup, remove the first target tuple from the identifier-indexed table and defer a removal of the second target tuple until, in response to a request to retrieve an identifier of a queue entry based at least in part on a priority criterion, a determination is made that the first target tuple has been removed from the identifier-indexed table. - View Dependent Claims (16, 17, 18, 19, 20, 21)
-
Specification