Claims
- 1. A method of managing a statement pool, the method comprising:
(a) accessing an unoptimized representation of statement among a plurality of statements in a statement pool utilized by a database; (b) generating an optimized representation of the statement from the unoptimized representation of the statement; and (c) replacing the unoptimized representation of the statement with the optimized representation of the statement in the statement pool.
- 2. The method of claim 1, further comprising tracking usage of at least a subset of the plurality of statements, wherein generating the optimized representation of the statement is performed based upon the tracked usage.
- 3. The method of claim 2, wherein tracking usage includes tracking at least one of a number of times and a last time that each of the subset of statements is used.
- 4. The method of claim 3, further comprising associating with the optimized representation of the statement a usage statistic generated for the unoptimized representation of the statement.
- 5. The method of claim 2, further comprising generating an optimized representation of a second statement among the plurality of statements, wherein generating the optimized representation of the second statement is performed subsequent to generation of the optimized representation of the first statement based upon respective usage statistics associated with the first and second statements.
- 6. The method of claim 1, further comprising associating with the optimized representation of the statement a statement signature for the unoptimized representation of the statement, the method further comprising accessing the optimized representation of the statement in response to a user request to access a statement having a statement signature corresponding to the unoptimized representation of the statement.
- 7. The method of claim 1, wherein generating the optimized representation of the statement includes modifying the unoptimized representation of the statement to instruct the database to convert returned data to a different format prior to returning the data.
- 8. The method of claim 7, wherein generating the optimized representation of the statement further includes determining that the unoptimized representation of the statement requests data in a first format from a field in the database that stores the data in a second format, wherein modifying the unoptimized representation of the statement includes modifying the unoptimized representation of the statement to instruct the database to convert the data to the first format prior to returning the data.
- 9. The method of claim 7, wherein the unoptimized statement is processed by a Java Database Connectivity driver and requests the data in Unicode format, and wherein modifying the unoptimized representation of the statement includes instructing the database to convert the data to the Unicode format prior to returning the data.
- 10. The method of claim 1, wherein generating the optimized representation of the statement includes modifying an access method to be used during execution of the statement.
- 11. The method of claim 1, wherein generating the optimized representation of the statement includes reordering a retrieval order for the data to be returned in response to execution of the statement.
- 12. The method of claim 1, wherein generating the optimized representation of the statement includes modifying the unoptimized representation of the statement to reference at least one stored procedure.
- 13. The method of claim 1, further comprising, after replacing the unoptimized representation of the statement with the optimized representation of the statement, processing a request to access the unoptimized representation of the statement by accessing the optimized representation of the statement.
- 14. An apparatus, comprising:
(a) a processor; and (b) program code configured to be executed by the processor to manage a statement pool utilized by a database by accessing an unoptimized representation of statement among a plurality of statements in the statement pool, generating an optimized representation of the statement from the unoptimized representation of the statement, and replacing the unoptimized representation of the statement with the optimized representation of the statement in the statement pool.
- 15. The apparatus of claim 14, wherein the program code is further configured to track usage of at least a subset of the plurality of statements, and to generate the optimized representation of the statement based upon the tracked usage.
- 16. The apparatus of claim 15, wherein the program code is configured to track usage by tracking at least one of a number of times and a last time that each of the subset of statements is used.
- 17. The apparatus of claim 16, wherein the unoptimized representation of the statement includes a statement object including at least one usage statistic.
- 18. The apparatus of claim 15, wherein the program code is further configured to generate an optimized representation of a second statement among the plurality of statements subsequent to generation of the optimized representation of the first statement based upon respective usage statistics associated with the first and second statements.
- 19. The apparatus of claim 14, wherein the program code is further configured to associate with the optimized representation of the statement a statement signature for the unoptimized representation of the statement, such that the program code accesses the optimized representation of the statement in response to a user request to access a statement having a statement signature corresponding to the unoptimized representation of the statement.
- 20. The apparatus of claim 14, wherein the program code is configured to generate the optimized representation of the statement by modifying the unoptimized representation of the statement to perform at least one of instructing the database to convert returned data to a different format prior to returning the data, modifying an access method to be used during execution of the statement, reordering a retrieval order for the data to be returned in response to execution of the statement, and referencing at least one stored procedure.
- 21. The apparatus of claim 20, wherein the program code is configured to generate the optimized representation of the statement further by determining that the unoptimized representation of the statement requests data in a first format from a field in the database that stores the data in a second format, and to modify the unoptimized representation of the statement by modifying the unoptimized representation of the statement to instruct the database to convert the data to the first format prior to returning the data.
- 22. The apparatus of claim 14, wherein the program code is further configured to, after replacing the unoptimized representation of the statement with the optimized representation of the statement, process a request to access the unoptimized representation of the statement by accessing the optimized representation of the statement.
- 23. A program product, comprising:
(a) program code configured to be executed by the processor to manage a statement pool utilized by a database by accessing an unoptimized representation of statement among a plurality of statements in a statement pool, generating an optimized representation of the statement from the unoptimized representation of the statement, and replacing the unoptimized representation of the statement with the optimized representation of the statement in the statement pool; and (b) a signal bearing medium bearing the program code.
- 24. The program product of claim 23, wherein the signal bearing medium includes at least one of a recordable medium and a transmission medium.
- 25. A method of managing a statement pool, the method comprising:
(a) tracking usage of a plurality of statements in a statement pool utilized by a database; and (b) selectively optimizing at least one of the statements from the statement pool based upon the tracked usage of the plurality of statements.
- 26. The method of claim 25, wherein tracking usage includes tracking at least one of a number of times and a last time that each of the statements is used.
- 27. The method of claim 25, further comprising selectively optimizing a second statement from the statement pool after selectively optimizing the first statement based upon the tracked usage indicating that the first statement has a higher usage than the second statement.
- 28. The method of claim 25, wherein selectively optimizing the statement further includes associating with an optimized representation of the statement a statement signature for an unoptimized representation of the statement, the method further comprising accessing the optimized representation of the statement in response to a user request to access a statement having a statement signature corresponding to the unoptimized representation of the statement.
- 29. The method of claim 25, wherein selectively optimizing the statement includes modifying an unoptimized representation of the statement to perform at least one of instructing the database to convert returned data to a different format prior to returning the data, modifying an access method to be used during execution of the statement, reordering a retrieval order for the data to be returned in response to execution of the statement, and referencing at least one stored procedure.
- 30. The method of claim 29, wherein selectively optimizing the statement further includes determining that the unoptimized representation of the statement requests data in a first format from a field in the database that stores the data in a second format, wherein modifying the unoptimized representation of the statement includes modifying the unoptimized representation of the statement to instruct the database to convert the data to the first format prior to returning the data.
- 31. The method of claim 30, wherein the unoptimized statement is processed by a Java Database Connectivity driver and requests the data in Unicode format, and wherein modifying the unoptimized representation of the statement includes modifying the unoptimized representation of the statement to instruct the database to convert the data to the Unicode format prior to returning the data.
- 32. The method of claim 25, further comprising, after selectively optimizing the statement, processing a request to access an unoptimized representation of the statement by accessing an optimized representation of the statement.
- 33. A method of managing a statement pool, the method comprising:
(a) identifying, from among a plurality of statements in a statement pool utilized by a database, a statement that requests data in a first format from a field in the database that stores the data in a second format; and (b) modifying the identified statement in the statement pool to instruct the database to convert the data to the first format prior to returning the data.
- 34. An apparatus, comprising:
(a) a processor; and (b) program code configured to be executed by the processor to manage a statement pool utilized by a database by tracking usage of a plurality of statements in the statement pool and selectively optimizing at least one of the statements from the statement pool based upon the tracked usage of the plurality of statements.
- 35. The apparatus of claim 34, wherein the program code is configured to track usage by tracking at least one of a number of times and a last time that each of the plurality of statements is used.
- 36. The apparatus of claim 34, wherein the program code is further configured to selectively optimize a second statement from the statement pool after selectively optimizing the first statement based upon the tracked usage indicating that the first statement has a higher usage than the second statement.
- 37. The apparatus of claim 34, wherein the program code is configured to selectively optimize the statement further by associating with an optimized representation of the statement a statement signature for an unoptimized representation of the statement, and to access the optimized representation of the statement in response to a user request to access a statement having a statement signature corresponding to the unoptimized representation of the statement.
- 38. The apparatus of claim 34, wherein the program code is configured to selectively optimize the statement by modifying an unoptimized representation of the statement to perform at least one of instructing the database to convert returned data to a different format prior to returning the data, modifying an access method to be used during execution of the statement, reordering a retrieval order for the data to be returned in response to execution of the statement, and referencing at least one stored procedure.
- 39. The apparatus of claim 34, wherein the program code is further configured to, after selectively optimizing the statement, process a request to access an unoptimized representation of the statement by accessing an optimized representation of the statement.
- 40. A program product, comprising:
(a) program code configured to be executed by the processor to manage a statement pool utilized by a database by tracking usage of a plurality of statements in the statement pool and selectively optimizing at least one of the statements from the statement pool based upon the tracked usage of the plurality of statements; and (b) a signal bearing medium bearing the program code.
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] This application is related to U.S. patent application Ser. No. 10/124,845, filed on Apr. 18, 2002 by Arnold et al., which application is incorporated by reference herein.