Prepare Statements in Advance
Performance impact: Large
For example, if your application generates statements like:
SELECT A FROM B WHERE C = 10; SELECT A FROM B WHERE C = 15;
You can replace these statements with the single statement:
SELECT A FROM B WHERE C = ?;
TimesTen shares prepared statements automatically after they have been committed. As a result, an application request to prepare a statement for execution may be completed very quickly if a prepared version of the statement already exists in the system. Also, repeated requests to run the same statement can avoid the prepare overhead by sharing a previously prepared version of the statement.
Even though TimesTen allows prepared statements to be shared, it is still a good practice for performance reasons to use parameterized statements. Using parameterized statements can further reduce prepare overhead, in addition to any savings from sharing statements.