IP Library Granted Patent US 11,138,196
Granted Patent B2
US 11,138,196 · App. 15/998,854 · Granted Oct 5, 2021

Maintaining data across query executions of a long-running query

Inventor: Rohitashva Mathur (Walnut Creek, CA)
Assignee: salesforce.com, inc.
G06F16/2455G06F16/2282G06F16/2379G06F16/2471G06F16/24558
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,138,196
App. No.
15/998,854
Granted
Oct 5, 2021
Kind
B2
Abstract

Disclosed herein are system, method, and computer program product embodiments for a query processing system. An embodiment operates by receiving a query associated with a table. An ordered index with entries that include key values that uniquely identifies a corresponding record in the table is determined. A last key value is initialized to store a minimum value for a data type of the key value. The query is executed as a union-all of a plurality of queries. While a count of selected records is less than or equal to a threshold quantity and at least one entry remains in the ordered index, an ordered next entry with a key value subsequent to the last key value in the index is identified, the corresponding record is selected from the table, the last key value is updated, the query is executed, and the count is incremented.

Claims (69)

1. A computer-implemented method, comprising:

receiving a query associated with a table;

determining an index comprising a plurality of ordered entries including at least:

a first entry corresponding to a first record in the table and comprising a first key value that uniquely identifies the first record in the table, and

a second entry corresponding to a second record in the table and comprising a second key value that uniquely identifies the second record in the table;

initializing, based on the index, a last key value variable comprising a first field and a second field,

wherein the last key value variable is initialized to store a minimum value for a first data type in the first field and to store a minimum value for a second data type in the second field, and

wherein the first data type and the second data type are associated with the first key value and the second key value in the index;

executing the query as a union-all of a plurality of queries, wherein each of the plurality of queries is executed against at most a threshold quantity of records from the table in accordance with the following:

initializing a count;

executing a plurality of operations comprising:

identifying an ordered next entry in the index, the identified ordered next entry comprising a key value that is subsequent to the last key value variable;

selecting, from the table, a next record corresponding to the identified ordered next entry from the index, wherein the key value in the identified ordered next entry uniquely identifies the selected next record;

updating the last key value variable by setting the last key value variable to the key value that uniquely identifies the selected next record;

executing a query of the plurality of queries against the selected next record; and

incrementing the count; and

while the count is less than or equal to the threshold quantity and at least one entry remains in the ordered index, repeating execution of the plurality of operations.

2. The method of claim 1 , wherein the index comprises an ascending ordered index, and wherein the identifying comprises identifying the ordered next entry with the key value greater than the last key value variable in the ascending ordered index.

3. The method of claim 1 , wherein the index comprises an descending ordered index, and wherein the identifying comprises identifying the ordered next entry with the key value less than the last key value variable in the descending ordered index.

4. The method of claim 1 , wherein each of the first key value and the second key value comprises a plurality of fields.

5. The method of claim 4 , wherein the plurality of fields comprises a field corresponding to the first data type and a field corresponding to the second data type.

6. The method of claim 1 , wherein the identifying comprises:

executing an idempotent function against the last key value variable and at least one entry from the ordered index to identify the larger of the last key value variable and the at least one entry.

7. The method of claim 1 , wherein the index includes values from a plurality of columns from the table that are ordered from a most significant column to a least significant column, and wherein the order of the columns in the index is different from an order of the columns in the table.

8. A system, comprising:

a memory; and

at least one processor coupled to the memory and configured to:

receive a query associated with a table;

determine an index comprising a plurality of ordered entries including at least:

a first entry corresponding to a first record in the table and comprising a first key value that uniquely identifies the first record in the table, and

a second entry corresponding to a second record in the table and comprising a second key value that uniquely identifies the second record in the table;

initialize, based on the index, a last key value variable comprising a first field and a second field,

wherein the last key value variable is initialized to store a minimum value for a first data type in the first field and to store a minimum value for a second data type in the second field, and

wherein the first data type and the second data type are associated with the first key value and the second key value in the index;

execute the query as a union-all of a plurality of queries, wherein each of the plurality of queries is executed against at most a threshold quantity of records from the table in accordance with the following:

initialize a count;

while the count is less than or equal to the threshold quantity and at least one entry remains in the ordered index:

identify an ordered next entry in the index, the identified ordered next entry comprising a key value that is subsequent to the last key value variable;

select, from the table, a next record corresponding to the identified ordered next entry from the index, wherein the key value in the identified ordered next entry uniquely identifies the selected next record;

update the last key value variable by setting the last key value variable to the key value that uniquely identifies the selected next record;

execute a query of the plurality of queries against the selected next record; and

increment the count.

9. The system of claim 8 , wherein the index comprises an ascending ordered index, and wherein the at least one processor that identifies is configured to identify the ordered next entry with the key value greater than the last key value variable in the ascending ordered index.

10. The system of claim 8 , wherein the index comprises an descending ordered index, wherein the at least one processor that identifies is configured to identify the ordered next entry with the key value less than the last key value variable in the descending ordered index.

11. The system of claim 8 , wherein each of the first key value and the second key value comprises a plurality of fields.

12. The system of claim 11 , wherein the plurality of fields comprises a field corresponding to the first data type and a field corresponding to the second data type.

13. The system of claim 8 , wherein the at least one processor that identifies is configured to:

execute an idempotent function against the last key value variable and at least one entry from the ordered index to identify the larger of the last key value variable and the at least one entry.

14. The system of claim 8 , wherein the index includes values from a plurality of columns from the table that are ordered from a most significant column to a least significant column, and wherein the order of the columns in the index is different from an order of the columns in the table.

15. A non-transitory computer-readable device having instructions stored thereon that, when executed by at least one computing device, cause the at least one computing device to perform operations comprising:

receiving a query associated with a table;

determining an index comprising a plurality of ordered entries including at least:

a first entry corresponding to a first record in the table and comprising a first key value that uniquely identifies the first record in the table, and

a second entry corresponding to a second record in the table and comprising a second key value that uniquely identifies the second record in the table;

initializing, based on the index, a last key value variable comprising a first field and a second field,

wherein the last key value variable is initialized to store a minimum value for a first data type in the first field and to store a minimum value for a second data type in the second field, and

wherein the first data type and the second data type are associated with the first key value and the second key value in the index;

executing the query as a union-all of a plurality of queries, wherein each of the plurality of queries is executed against at most a threshold quantity of records from the table in accordance with the following:

initializing a count;

while the count is less than or equal to the threshold quantity and at least one entry remains in the ordered index:

identifying an ordered next entry in the index, the identified ordered next entry comprising a key value that is subsequent to the last key value;

selecting, from the table, a next record corresponding to the identified ordered next entry from the index, wherein the key value in the identified ordered next entry uniquely identifies the selected next record;

updating the last key value variable by setting the last key value variable to the key value that uniquely identifies the selected next record;

executing a query of the plurality of queries against the selected next record; and

incrementing the count.

16. The non-transitory computer-readable device of claim 15 , wherein the index comprises an ascending ordered index, and wherein the processor that performs the identifying, further performs operations comprising identifying the ordered next entry with the key value greater than the last key value variable in the ascending ordered index.

17. The non-transitory computer-readable device of claim 15 , wherein the index comprises an descending ordered index, and wherein the processor that performs the identifying, further performs operations comprising identifying the ordered next entry with the key value less than the last key value variable in the descending ordered index.

18. The non-transitory computer-readable device of claim 15 , wherein:

each of the first key value and the second key value comprises a field corresponding to the first data type and a field corresponding to the second data type.

Assignments (2)
CHANGE OF NAME Recorded Dec 18, 2024
From: SALESFORCE.COM, INC.
To: SALESFORCE, INC.
Reel/Frame 069717/0333 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 9, 2020
From: MATHUR, ROHITASHVA
To: SALESFORCE.COM, INC.
Reel/Frame 054592/0056 →
Continuity (1)
Related Publication 20200057819A1 · Feb 20, 2020