A mechanism for rewriting a bounded query onto a view is disclosed. A query, access constraints, and cached view(s) are obtained. The cached view(s) contain results of the query as applied to a dataset stored in a database. A query rewriting plan is generated by adding a fetch from query operation to the plan when a rewritten query variable can be fetched from a query constant. A fetch from database operation is added to the plan when a rewritten query variable can be fetched as a query variable that obtains bounded data from the database. An access view operation is added to the plan when a rewritten query variable can be fetched from the cached view. The query rewriting plan is executed to fetch retrieved data. The query is executed on the retrieved data to determine updated results to the query without reapplying the query to the dataset.
展开▼