Embodiments of the present invention provide an ad-hoc query engine. The
ad-hoc query engine comprises a query management module, a metadata
module, a data cache module and a viewer module. The query management
module receives a query request from a client device. The query request
is specified in terms of a plurality of business objects. The query
management module utilizes the metadata module to translate the business
objects into a structured query language statement as a function of the
content of the data cache module. The SQL statement comprises a plurality
of aggregation. The query management module dynamically causes each
aggregation to be re-directed to execute against the content of the data
cache module, when the aggregation is locally or linearly computable from
said content of said data cache module. The query management utilizes the
viewer module to generate a report as a function of the results of the
executed SQL statement.