Method for minimizing the number of sorts required for a query block containing window functions
AssigneeOracle Corporation
InventorAbhinav Gupta
Life of this patent
Estimating the term…
Abstract
Techniques are described for reducing the number of sort operations required for a query that contains window functions. The techniques involves determining a set of Partition By and Order By clause pairs that corresponds to the set of window functions and then grouping the Partition By and Order By clause pairs into Ordering Groups where each Ordering Group may be satisfied by a single sort operation. From the set of Ordering Groups, a minimal set of Ordering Groups is determined. The techniques account for the interaction of orderings from Group By and Order By clauses in the query block.
Claims18
A method for reducing how many sort operations are performed to satisfy a query containing a set of window functions, the method comprising the computer-implemented steps of:
- grouping the window functions in the set of window functions into a set of Ordering Groups, wherein each Ordering Group in the set of Ordering Groups is a subset of the set of window functions and wherein each Ordering Group can be satisfied by a single sort operation;
- selecting from the set of Ordering Groups a minimal set of Ordering Groups, wherein the minimal set of Ordering Groups corresponds to a reduced number of sort operations needed to satisfy sorting requirements of the window functions in the set of window functions;
- and
- to generate a result set for the query, performing the sort operations associated with the Ordering Groups that belong to the minimal set of Ordering Groups.
A computer-readable medium bearing instructions for reducing how many sort operations are performed to satisfy a query containing a set of window functions, the computer-readable medium comprising instructions for performing the steps of:
- grouping the window functions in the set of window functions into a set of Ordering Groups, wherein each Ordering Group in the set of Ordering Groups is a subset of the set of window functions and wherein each Ordering Group can be satisfied by a single sort operation;
- selecting from the set of Ordering Groups a minimal set of Ordering Groups, wherein the minimal set of Ordering Groups corresponds to a reduced number of sort operations needed to satisfy sorting requirements of the window functions in the set of window functions;
- and
- to generate a result set for the query, performing the sort operations associated with the Ordering Groups that belong to the minimal set of Ordering Groups.
Dependencies are inferred from the claim text.