Patent ID: 8250064

Claim:
A method comprising: receiving a query Q 1 in a computer system programmed as a database, Q 1 including a predicate, the predicate including a reference to a current timestamp of time TT 1 , the database having R data structures; the computer system creating a plan, Plan 1 , to execute Q 1 , Plan 1 including the identification of a first set of data structures, P 1 , to be accessed in executing Plan 1 , at the current timestamp of time TT 1 , the number of data structures in P 1 being less than R; the computer system determining that Plan 1 is valid for a period of time by determining that a plan, Plan 2 , to execute Q 1 during a period between TT 1 and TT 2 , TT 2 being later than TT 1 , accesses a second set of data structures, P 2 , P 2 being contained in P 1 ; storing in a cache: Plan 1 ; and an indication that Plan 1 is valid for the period of time; receiving a query Q 2 in the database, Q 2 including a predicate, the predicate including a reference to a current timestamp of time TT 3 ; and determining that Q 2 is equivalent to Q 1 and that TT 3 is in the period between TT 1 and TT 2 and in response, using the cached plan, Plan 1 , to execute Q 2 .