devloop icon
Metastores

database performance: Java Linux Databases: Prepared Statements


Beyond the fact that prepared statements will automatically protect your applications from SQL-injections and quoting issues, prepared statements provide the largest performance increase of all the code tweaks we have tested here.

It is not uncommon to see the performance doubled by using prepared statements, but there are exceptions (DB2 and Postgres do not benefit as much):

Another good example of performance improvements was shown on the select performance page.

Most O/R frameworks will use prepared statements automatically.
There are more examples of the benefits of using prepared statements in the non-threaded tests in the previous chapters.

Jump to page:

Index