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.