Partial pre-aggregation in relational database queries
First Claim
1. A computer-implemented method of processing a database query, wherein the database query comprises a join operator and an aggregation operator, the method comprising:
- inputting one or more records into a single record store memory, wherein the one or more records represent one or more rows of a table, the table having columns representing one or more fields;
determining a value of a column associated with an aggregation operator;
determining a value of a column associated with a join operator;
determining when the value of the column associated with the aggregation operator is equivalent to the value of the column associated with the join operator;
estimating costs and benefits of a partial pre-aggregation, and if indicated by the estimate, utilizing the aggregation operator to partially pre-aggregate the one or more records input into the single record store memory to form partially pre-aggregated records as the one or more records are loaded into the single record store memory;
joining the partially pre-aggregated records if the estimation indicates in the single record store memory utilizing the join operator while concurrently processing a partial pre-aggregation of the records from the database; and
outputting a resulting set of records from the single record store memory to a subsequent database operation.
1 Assignment
0 Petitions
Accused Products
Abstract
A partial pre-aggregation database operation improves processing efficiency of database queries by reducing the number of records input into a subsequent database operation, provided the query includes a final aggregation. A query optimizer is provided to determine when it is economical to partially pre-aggregate data records and when it is not. The partial pre-aggregation creates a record store in memory as input records are received. The record store is then used by another database operator, which saves the other database operator from having to re-create the record store.
24 Citations
20 Claims
-
1. A computer-implemented method of processing a database query, wherein the database query comprises a join operator and an aggregation operator, the method comprising:
-
inputting one or more records into a single record store memory, wherein the one or more records represent one or more rows of a table, the table having columns representing one or more fields; determining a value of a column associated with an aggregation operator; determining a value of a column associated with a join operator; determining when the value of the column associated with the aggregation operator is equivalent to the value of the column associated with the join operator; estimating costs and benefits of a partial pre-aggregation, and if indicated by the estimate, utilizing the aggregation operator to partially pre-aggregate the one or more records input into the single record store memory to form partially pre-aggregated records as the one or more records are loaded into the single record store memory; joining the partially pre-aggregated records if the estimation indicates in the single record store memory utilizing the join operator while concurrently processing a partial pre-aggregation of the records from the database; and outputting a resulting set of records from the single record store memory to a subsequent database operation. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 19)
-
-
9. A relational database system configured to process a database query, the relational database system comprising:
-
memory for storing a record store, the memory having a portion available for query processing; and a query processor coupled to the memory to process the query using the record store, wherein processing the query using the record store comprises; one or more records in a single record store memory, wherein the one or more records represent one or more rows of a table, the table having columns representing one or more fields; a value of a column associated with an aggregation operator; a value of a column associated with a join operator, when the value of the column associated with the aggregation operator is equivalent to the value of the column associated with the join operator; an estimation estimating a cost and benefit of a partial pre-aggregation, and if indicated by the estimate, utilizing the aggregation operator to partially pre-aggregate the one or more records input into the single record store memory to form partially pre-aggregated records as the one or more records are loaded into the single record store memory; a join operator joining the partially pre-aggregated records in the single record store memory utilizing the join operator while concurrently processing a partial pre-aggregation of the records from the database; and a resulting set of records output from the single record store memory to a subsequent database operation. - View Dependent Claims (10, 11, 12, 13, 14)
-
-
15. A computer-readable storage medium having computer-executable instructions stored thereon that, when executed, direct a computer to perform a method of processing a database query, wherein the query comprises a join operator and an aggregation operator, the method comprising:
-
inputting one or more records into a single record store memory, wherein the one or more records represent one or more rows of a table, the table having columns representing one or more fields; determining a value of a column associated with an aggregation operator; determining a value of a column associated with a join operator; determining when the value of the column associated with the aggregation operator is equivalent to the value of the column associated with the join operator; estimating costs and benefits of a partial pre-aggregation, and if indicated by the estimate, utilizing the aggregation operator to partially pre-aggregate the one or more records input into the single record store memory to form partially pre-aggregated records as the one or more records are loaded into the single record store memory; joining the partially pre-aggregated records if the estimation indicates in the single record store memory utilizing the join operator while concurrently processing a partial pre-aggregation of the records from the database; and outputting a resulting set of records from the single record store memory to a subsequent database operation. - View Dependent Claims (16)
-
-
17. A relational database computer program stored on a computer-readable storage medium, the relational database computer program comprising computer-executable instructions that, when executed, direct a computer to perform a method of processing a query, wherein the query comprises a join operator and an aggregation operator, the method comprising:
-
inputting one or more records into a single record store memory, wherein the one or more records represent one or more rows of a table, the table having columns representing one or more fields; determining a value of a column associated with an aggregation operator; determining a value of a column associated with a join operator; determining when the value of the column associated with the aggregation operator is equivalent to the value of the column associated with the join operator; estimating costs and benefits of a partial pre-aggregation, and if indicated by the estimate, utilizing the aggregation operator to partially pre-aggregate the one or more records input into the single record store memory to form partially pre-aggregated records as the one or more records are loaded into the single record store memory; joining the partially pre-aggregated records if the estimation indicates in the single record store memory utilizing the join operator while concurrently processing a partial pre-aggregation of the records from the database; and outputting a resulting set of records from the single record store memory to a subsequent operation. - View Dependent Claims (18)
-
-
20. A method for processing a database query according to at least one grouping column value, the method comprising:
-
estimating costs and benefits of a partial pre-aggregation, wherein an estimate of a number of records that would be output from the partial pre-aggregation is based on a formula having inputs comprising;
a memory space for group records, M;
a number of input records, N, N being greater than a number, D, of records after full aggregation; and
an absorption power term, wherein the absorption power term comprises a summation of D terms, each term including a probability of a record belonging in a group of records;partially pre-aggregating records in a database to provide a result that contains at least two records having like grouping column values, wherein the partially pre-aggregating further comprises; maintaining a record store in memory, the record store having one record for each different grouping column encountered in the operation; receiving a new record; combining the new record with a record having the same grouping column value, if such a record exists; and adding the new record to the record store in the memory if there is no record in the record store that has the same grouping column value as the new record; aggregating records derived from the partial pre-aggregation to provide a result that contains records having unique grouping column values; adding additional new records to the record store until the record store reaches a capacity such that it can accept no new records; and outputting one or more records from the record store to a subsequent database operator.
-
Specification