IP Library Granted Patent US 12,393,578
Granted Patent B1
US 12,393,578 · App. 18/667,591 · Granted Aug 19, 2025

Sort optimization

Inventors: Mohammed Sayeed Akthar (Hayathnagar, IN); Sunil Jardosh (Miyapur, IN)
Assignee: Progress Software Corporation
G06F16/244G06F16/221G06F16/2282G06F16/2445G06F16/284
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 12,393,578
App. No.
18/667,591
Filed
May 17, 2024
Granted
Aug 19, 2025
Kind
B1
Examiner
VY, HUNG T
Art Unit
2163
USPC
707/722
Abstract

A system and method for processing of queries including receiving a query including a set operation and a sort operation, wherein the set operation includes a first data structure and a second data structure and the sort operation requests a result set that is sorted based on a column or attribute of the first data structure and a column or attribute of the second data structure; generating a query plan in which a sort operation occurs prior to the set operation; determining a first, partial set of one or more resultant rows responsive to the query; sending the first, partial set of one or more resultant rows responsive to the query to a client; determining a second, partial set of one or more resultant rows responsive to the query; and sending the second, partial set of one or more resultant rows to the client.

Claims (51)

1. A computer-implemented method comprising:

obtaining, using one or more processors, a first row from a first data structure subsequent to receiving a query including a set operation and a sort operation, wherein the set operation identifies the first data structure and a second data structure, and wherein the sort operation requests a result set that is sorted based on a first column or attribute of the first data structure and a second column or attribute of the second data structure;

determining, using the one or more processors, that a first column or attribute value of the first row in the first data structure is the same as a first column or attribute value for a prior row, wherein the first data structure is ordered based on first column or attribute values;

responsive to determining that the first column or attribute value of the first row in the first data structure is the same as the first column or attribute value for the prior row:

obtaining, using the one or more processors, one or more matching rows from the second data structure based on the set operation, wherein the one or more matching rows include rows from the second data structure that are associated with a second column or attribute value equal to the first column or attribute value associated with the first row in the first data structure;

adding, using the one or more processors, the one or matching rows from the second data structure in association with the first column or attribute value associated with the first row to a first partial result set;

determining, using the one or more processors, that a first column or attribute value of a second row in the first data structure is not the same as the first column or attribute value for the first row; and

responsive to determining that the first column or attribute value of the second row in the first data structure is not the same as the first column or attribute value for the first row, sending, using the one or more processors, the first partial result set responsive to the query.

2. The computer-implemented method of claim 1 , the method further comprising:

responsive to determining that the first column or attribute value of the second row in the first data structure is not the same as the first column or attribute value for the first row, determining, using the one or more processors, a second partial result set associated with the second row; and

sending, using the one or more processors, the second partial result set responsive to the query.

3. The computer-implemented method of claim 2 , wherein a full result set comprises the first partial result set and the second partial result set.

4. The computer-implemented method of claim 1 , comprising:

merging the first partial result set with a third partial result set, wherein the third partial result set is associated the prior row in the first data structure, and wherein the first partial result set and the third partial result set

have a common first column or attribute value on which the sort operation is requested.

5. The computer-implemented method of claim 1 , wherein the first partial result set is buffered, the computer-implemented method further comprising:

and

clearing the buffer subsequent to determining that the first column or attribute value of the second row in the first data structure is not the same as the first column or attribute value for the first row and sending the first partial result set responsive to the query.

6. The computer-implemented method of claim 1 including:

determining, using the one or more processors, whether the first column or attribute of the first data structure has an index of the first data structure defined on it; and

determining, using the one or more processors, whether the second column or attribute of the second data structure has an index of the second data structure defined on it.

7. The computer-implemented method of claim 1 , wherein the first data structure and the second data structure are relational tables.

8. The computer-implemented method of claim 1 , wherein the first data structure and the second data structure are non-relational data structures.

9. The computer-implemented method of claim 1 , wherein the query uses structured query language (SQL).

10. The computer-implemented method of claim 1 , wherein the set operation is one or more of an inner join, left outer join, right outer join, full outer join and cross join.

11. The computer-implemented method of claim 1 , wherein the first column or attribute value of the first data structure of the first row is determined to be the same as the first column attribute value for a prior row when there is no prior row.

12. A system comprising:

one or more processors; and

a memory storing instructions that, when executed by the one or more processors, cause the system to:

obtain a first row from a first data structure subsequent to receiving a query including a set operation and a sort operation, wherein the set operation identifies the first data structure and a second data structure and the sort operation requests a result set that is sorted based on a first column or attribute of the first data structure and a second column or attribute of the second data structure;

determine that a first column or attribute value of the first row in the first data structure is the same as a first column or attribute value for a prior row, wherein the first data structure is ordered based on first column or attribute values;

responsive to determining that the first column or attribute value of the first row in the first data structure is the same as the first column or attribute value for the prior row:

obtain one or more matching rows from the second data structure based on the set operation, wherein the one or more matching rows include rows from the second data structure that are associated with a second column or attribute value equal to the first column or attribute value associated with the first row in the first data structure;

add the one or matching rows from the second data structure in association with the first column or attribute value associated with the first row to a first partial result set;

determine that a first column or attribute value of a second row in the first data structure is not the same as the first column or attribute value for the first row; and

responsive to determining that the first column or attribute value of the second row in the first data structure is not the same as the first column or attribute value for the first row, send the first partial result set responsive to the query.

13. The system of claim 12 , wherein the instructions, when executed by the one or more processors, cause the system to:

responsive to determining that the first column or attribute value of the second row in the first data structure is not the same as the first column or attribute value for the first row, determine a second partial result set associated with the second row; and

send the second partial result set responsive to the query.

14. The system of claim 12 , wherein the instructions, when executed by the one or more processors, cause the system to:

merge the first partial result set with a third partial result set, wherein the third partial result set is associated the prior row in the first data structure, and wherein the first partial result set and the third partial result set

have a common first column or attribute value on which the sort operation is requested.

15. The system of claim 14 , wherein the first partial result set is buffered, and wherein the instructions, when executed by the one or more processors, cause the system to:

clear the buffer subsequent to determining that the first column or attribute value of the second row in the first data structure is not the same as the first column or attribute value for the first row and sending the first partial result set responsive to the query.

16. The system of claim 12 , wherein the instructions, when executed by the one or more processors, cause the system to:

determine whether the first column or attribute of the first data structure has an index of the first data structure defined on it; and

determine whether the second column or attribute of the second data structure has an index of the second data structure defined on it.

17. The system of claim 12 , wherein the first data structure and the second data structure are relational tables.

18. The system of claim 12 , wherein the first data structure and the second data structure are non-relational data structures.

19. The system of claim 12 , wherein the set operation is one or more of an inner join, left outer join, right outer join, full outer join and cross join.

20. The system of claim 12 , wherein the first column or attribute value of the first data structure of the first row is determined to be the same as the first column attribute value for a prior row when there is no prior row.