Dynamic optimization of prepared statements in a statement pool
First Claim
1. A method of managing a statement pool, the method comprising:
- accessing an unoptimized representation of a statement among a plurality of statements in a statement pool utilized by a database, wherein the unoptimized representation of the statement is a prepared statement;
with at least one hardware-implemented processor, generating an optimized representation of the statement from the unoptimized representation of the statement, wherein the optimized representation of the statement is a prepared statement;
replacing the unoptimized representation of the statement with the optimized representation of the statement in the statement pool;
associating with the optimized representation of the statement a statement signature for the unoptimized representation of the statement; and
accessing the optimized representation of the statement in response to a user request to access the statement having the statement signature corresponding to the unoptimized representation of the statement, wherein the 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, wherein the 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, and wherein the 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.
2 Assignments
0 Petitions
Accused Products
Abstract
An apparatus, program product and method dynamically optimize prepared statements resident in a statement pool to permit subsequent reuses of such statements to utilize the optimized representations of such statements. The optimization of pooled statements may be performed responsive to the tracked usage of the statements in a statement pool, to direct the overhead associated with such optimization to those statements that are more likely to be utilized in the future. Among a multitude of possible optimizations, a pooled statement that requests data in a format other than that utilized by the database being accessed may be modified to request the data in the format used by the database, thereby decreasing the overhead in the database associated with format conversions.
-
Citations
18 Claims
-
1. A method of managing a statement pool, the method comprising:
-
accessing an unoptimized representation of a statement among a plurality of statements in a statement pool utilized by a database, wherein the unoptimized representation of the statement is a prepared statement; with at least one hardware-implemented processor, generating an optimized representation of the statement from the unoptimized representation of the statement, wherein the optimized representation of the statement is a prepared statement; replacing the unoptimized representation of the statement with the optimized representation of the statement in the statement pool; associating with the optimized representation of the statement a statement signature for the unoptimized representation of the statement; and accessing the optimized representation of the statement in response to a user request to access the statement having the statement signature corresponding to the unoptimized representation of the statement, wherein the 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, wherein the 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, and wherein the 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. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
-
11. An apparatus, comprising:
-
a processor; a memory; 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, wherein each of the unoptimized and optimized representations of the statement is a prepared statement; and the program code 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 the statement having the statement signature corresponding to the unoptimized representation of the statement, wherein the 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, and wherein the 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, and wherein the 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. - View Dependent Claims (12, 13, 14, 15, 16, 17)
-
-
18. A program product stored in a recordable medium, the program product comprising:
-
program code configured to be executed by a 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, wherein each of the unoptimized and optimized representations of the statement is a prepared statement; and the program code 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 the statement having the statement signature corresponding to the unoptimized representation of the statement, wherein the 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, and wherein the 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, and wherein the 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.
-
Specification