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.