Patent ID: 7523094

Claim:
A method of optimizing a first access plan for a first database query, said method comprising: querying a plan cache; wherein said plan cache comprises one or more cached queries; determining one or more cache-query database objects referenced by any of said one or more cached queries; asynchronously querying, monitoring, and recording a first status for a first cache-query database object of said one or more cache-query database objects via a storage management interface; wherein if said first cache-query database object is cached and accessing said first cache-query database object consumes a logical access to a cached data, then said first status is warm-status type; wherein if said first cache-query database object is not cached and accessing said first cache-query database object consumes a physical disk drive access, then said first status is cold-status type; cost-based optimizing said first access plan for said first database query; wherein said first database query references one or more query-referenced database objects; determining a second status of a first query-referenced database object of said one or more query-referenced database objects; wherein, in said determining said second status, if said first query-referenced database object is the same as said first cache-query database object, then setting said second status to said first status; wherein in said determining said second status step, if said first status is cold-status, then setting said second status to warm-status if there is a prior query optimization associated with an access plan for accessing said first query-referenced database object; wherein said prior query optimization is one of a recently completed query optimization or an ongoing query optimization; in said cost-based optimizing step, determining a cost of access to said first query-referenced database object based on said second status; in said cost-based optimizing step, if a second cache query of said one or more cached queries is the same as said first database query, then validating a second access plan associated with said second cached query, and if said second access plan is validated, then reusing said second access plan for said first access plan; wherein said validating said second access plan fails, if a cache status of any database object referenced by said second cached query is changed since said second cached query was executed; and determining whether to remove said second access plan from said plan cache, if said validating said second access plan fails.