Claims
- 1. An apparatus comprising:
at least one processor; a memory coupled to the at least one processor; and a query refresher residing in the memory and executed by the at least one processor, the query refresher determining whether a query to be optimized differs only in data type from a stored optimized query, and if so, the query refresher retrieves the stored optimized query and refreshes the stored optimized query to reflect a change in data type.
- 2. The apparatus of claim 1 wherein the query to be optimized comprises a query to a database.
- 3. The apparatus of claim 1 wherein the refreshing of the stored optimized query comprises changing at least one operand specified in the stored optimized query to an operand of a different data type, and changing at least one method pointer to point to code that processes the operand of the different data type.
- 4. The apparatus of claim 1 wherein the query refresher stores the refreshed query as a stored optimized query.
- 5. An apparatus comprising:
at least one processor; a memory coupled to the at least one processor; a database residing in the memory; a plurality of optimized queries residing in the memory; a query refresher that determines whether a query to be optimized differs only in data type from a selected one of the plurality of optimized queries, and if so, the query refresher retrieves the selected one optimized query and refreshes the selected one optimized query by changing at least one operand specified in the selected one optimized query to an operand of a different data type, and changing at least one method pointer to point to code that processes the operand of the different data type.
- 6. The apparatus of claim 5 wherein the query refresher stores the refreshed query in the memory as one of the plurality of optimized queries.
- 7. An apparatus comprising:
at least one processor; a memory coupled to the at least one processor; a database residing in the memory; a plurality of optimized queries residing in the memory, each optimized query comprising a collection of object oriented objects that include an attribute operation list that specifies at least one operation to perform on at least one operand identified by an attribute descriptor array, the attribute operation list including a call to at least one method vector that identifies a method pointer corresponding to a selected data type, wherein the method pointer points to code that processes operands of the selected data type; a query refresher that determines whether a query to be optimized differs only in data type of at least one operand from a selected one of the plurality of optimized queries, and if so, the query refresher updates the attribute descriptor array to reference at least one operand of a different data type and changes at least one method pointer to point to code that processes the operand of the different data type.
- 8. The apparatus of claim 7 wherein the query refresher further changes the attribute descriptor array of the previously-optimized query to represent the change in data type for the at least one operand.
- 9. A method for optimizing a database query, the method comprising the steps of:
(A) determining whether the database query is identical to a previously-optimized query; (B1) if the database query is identical to a previously-optimized query, retrieving the previously-optimized query; (B2) if the database query is not identical to a previously-optimized query, determining whether the database query differs only in data type from a previously-optimized query;
(B2A) if the database query differs only in data type from the previously-optimized query, performing the steps of:
(C1) retrieving the previously-optimized query; (C2) refreshing the previously-optimized query to reflect a change in data type to at least one operand in the previously-optimized query; and (C3) storing the refreshed query.
- 10. The method of claim 9 further comprising the step of:
(C4) executing the refreshed query.
- 11. The method of claim 9 wherein the database query differs only in data type from the previously-optimized query if the database query references an operand that has a different data type than the corresponding operand in the previously-optimized query.
- 12. The method of claim 9 further comprising the step of:
(B2B) if the database query differs more than only in data type from the previously-optimized query, performing the steps of:
(B2B1) optimizing the database query; and (B2B2) storing the optimized database query.
- 13. A method for executing a database query, the method comprising the steps of:
(A) determining whether the database query is identical to a previously-optimized query; (B1) if the database query is identical to a previously-optimized query, retrieving the previously-optimized query and executing the previously-optimized query; (B2) if the database query is not identical to a previously-optimized query, determining whether the database query differs only in data type from the previously-optimized query;
(B2A) if the database query differs only in data type from the previously-optimized query, performing the steps of:
(B2A1) retrieving the previously-optimized query; (B2A2) refreshing the previously-optimized query to reflect a change in data type to at least one operand in the previously-optimized query; (B2A3) storing the refreshed query; and (B2A4) executing the refreshed query; (B2B) if the database query differs more than only in data type from the previously-optimized query, performing the steps of:
(B2B1) optimizing the database query; (B2B2) storing the optimized database query; and (B2B3) executing the optimized database query.
- 14. The method of claim 13 wherein step (B2A2) comprises the steps of:
updating an attribute descriptor array to point to at least one new operand that has a data type that is different from the corresponding operand in the previously-optimized query; and updating a method pointer to point to code that processes operands of the different data type.
- 15. A program product comprising:
(A) a query refresher that determines whether a query to be optimized differs only in data type from a stored optimized query, and if so, the query refresher retrieves the stored optimized query and refreshes the stored optimized query to reflect a change in data type; and (B) computer-readable signal bearing media bearing the query refresher.
- 16. The program product of claim 15 wherein the computer-readable signal bearing media comprises recordable media.
- 17. The program product of claim 15 wherein the computer-readable signal bearing media comprises transmission media.
- 18. The program product of claim 15 wherein the query to be optimized comprises a query to a database.
- 19. The program product of claim 15 wherein the refreshing of the stored optimized query comprises changing at least one operand specified in the stored optimized query to an operand of a different data type, and changing at least one method pointer to point to code that processes the operand of the different data type.
- 20. The program product of claim 15 wherein the query refresher stores the refreshed query as a stored optimized query.
- 21. A program product comprising:
(A) a query refresher that determines whether a query to be optimized differs only in data type from a selected one of a plurality of optimized queries, and if so, the query refresher retrieves the selected one optimized query and refreshes the selected one optimized query by changing at least one operand specified in the selected one optimized query to an operand of a different data type, and changing at least one method pointer to point to code that processes the operand of the different data type; and (B) computer-readable signal bearing media bearing the query refresher.
- 22. The program product of claim 21 wherein the computer-readable signal bearing media comprises recordable media.
- 23. The program product of claim 21 wherein the computer-readable signal bearing media comprises transmission media.
- 24. A program product comprising:
(A) a query refresher that determines whether a query to be optimized differs only in data type of at least one operand from a selected one of the plurality of optimized queries, each optimized query comprising a collection of object oriented objects that include an attribute operation list that specifies at least one operation to perform on at least one operand identified by an attribute descriptor array, the attribute operation list including a call to at least one method vector that identifies a method pointer corresponding to a selected data type, wherein the method pointer points to code that processes operands of the selected data type, and if the query to be optimized differs only in data type of at least one operand from the selected one optimized query, the query refresher updates the attribute descriptor array to reference at least one operand of a different data type and changes at least one method pointer to point to code that processes the operand of the different data type; and (B) computer-readable signal bearing media bearing the query refresher.
- 25. The program product of claim 24 wherein the computer-readable signal bearing media comprises recordable media.
- 26. The program product of claim 24 wherein the computer-readable signal bearing media comprises transmission media.
PARENT APPLICATION
[0001] This patent application is a continuation-in-part of “OBJECT-ORIENTED QUERY EXECUTION DATA STRUCTURE”, U.S. Ser. No. 10/165,293, filed on Jun. 7, 2002 by Carlson et al., which is incorporated herein by reference.
[0002] This application is related to “PARALLEL DATABASE QUERY PROCESSING FOR NON-UNIFORM DATA SOURCES VIA BUFFERED ACCESS”, U.S. Ser. No. 10/165,235, filed on Jun. 7, 20002 by Carlson et al., “RUNTIME QUERY OPTIMIZATION FOR DYNAMICALLY SELECTING FROM MULTIPLE PLANS IN A QUERY BASED UPON RUNTIME-EVALUATED PERFORMANCE CRITERION”, U.S. Ser. No. 10/165,025, filed on Jun. 7, 2002 by Carlson et al., and “METHOD FOR EFFICIENT PROCESSING OF MULTI-STATE ATTRIBUTES”, U.S. Ser. No. 10/164,767, filed on Jun. 7, 2002 by Carlson et al., which are all incorporated herein by reference.
Continuation in Parts (1)
|
Number |
Date |
Country |
Parent |
10165293 |
Jun 2002 |
US |
Child |
10230641 |
Aug 2002 |
US |