A system and method for avoiding accessing a remote database twice, once during
query execution and again to retrieve objects identified by the query, when an
application requires objects on which to operate. During query plan generation
in response to a request for database objects from an application, a query optimizer
inserts cache operators into the candidate plans, and then a cost-benefit analysis
is undertaken to identify the best plan. The best plan is then used to execute
the query, with the cache operators causing objects identified during query execution
to be cached locally to the requesting application as the query is being executed,
thereby avoiding requiring the application to access the database after query execution.