Caching execution plans for queries that use timestamps
First Claim
Patent Images
1. A method comprising:
- receiving a query Q1 in a computer system programmed as a database, Q1 including a predicate, the predicate including a reference to a current timestamp of time TT1, the database having R data structures;
the computer system creating a plan, Plan 1, to execute Q1, Plan 1 including the identification of a first set of data structures, P1, to be accessed in executing Plan 1, at the current timestamp of time TT1, the number of data structures in P1 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 Q1 during a period between TT1 and TT2, TT2 being later than TT1, accesses a second set of data structures, P2, P2 being contained in P1;
storing in a cache;
Plan 1; and
an indication that Plan 1 is valid for the period of time;
receiving a query Q2 in the database, Q2 including a predicate, the predicate including a reference to a current timestamp of time TT3; and
determining that Q2 is equivalent to Q1 and that TT3 is in the period between TT1 and TT2 and in response, using the cached plan, Plan 1, to execute Q2.
1 Assignment
0 Petitions
Accused Products
Abstract
A computer system programmed as a database receives a query Q1. Q1 includes a predicate. The predicate includes a reference to a current timestamp of time TT1. The database has R data structures. The computer system creates a plan, Plan 1, to execute Q1. Plan 1 includes the identification of a first set of data structures, P1, to be accessed in executing Plan 1, at the current timestamp of time TT1. The number of data structures in P1 is less than R. The computer system determines that Plan 1 is valid for a period of time. The computer system stores in a cache Plan 1 and an indication that Plan 1 is valid for the period of time.
22 Citations
16 Claims
-
1. A method comprising:
-
receiving a query Q1 in a computer system programmed as a database, Q1 including a predicate, the predicate including a reference to a current timestamp of time TT1, the database having R data structures; the computer system creating a plan, Plan 1, to execute Q1, Plan 1 including the identification of a first set of data structures, P1, to be accessed in executing Plan 1, at the current timestamp of time TT1, the number of data structures in P1 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 Q1 during a period between TT1 and TT2, TT2 being later than TT1, accesses a second set of data structures, P2, P2 being contained in P1; storing in a cache; Plan 1; and an indication that Plan 1 is valid for the period of time; receiving a query Q2 in the database, Q2 including a predicate, the predicate including a reference to a current timestamp of time TT3; and determining that Q2 is equivalent to Q1 and that TT3 is in the period between TT1 and TT2 and in response, using the cached plan, Plan 1, to execute Q2. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A computer program, stored in a non-transitory computer-readable medium, the program comprising executable instructions that cause a computer to:
-
receive a query Q1 in a computer system programmed as a database, Q1 including a predicate, the predicate including a reference to a current timestamp of time TT1, the database having R data structures; create a plan, Plan 1, to execute Q1, Plan 1 including the identification of a first set of data structures, P1, to be accessed in executing Plan 1, at the current timestamp of time TT1, the number of data structures in P1 being less than R; determine that Plan 1 is valid for a period of time by determining that a plan, Plan 2, to execute Q1 during a period between TT1 and TT2, TT2 being later than TT1, accesses a second set of data structures, P2, P2 being contained in P1; store in a cache; Plan 1; and an indication that Plan 1 is valid for the period of time; receive a query Q2 in the database, Q2 including a predicate, the predicate including a reference to a current timestamp of time TT3; and determine that Q2 is equivalent to Q1 and that TT3 is in the period between TT1 and TT2 and in response, use the cached plan, Plan 1, to execute Q2. - View Dependent Claims (10, 11, 12, 13, 14, 15, 16)
-
Specification