# The tips

- Use prepared statements with substitution parameters to save on costly compilation time. Prepared statements using substitution parameters significantly improves performance in applications using standard statements.
- Create indexes, and make sure they are being used. Indexes speed up queries dramatically if the table is much larger than the number of rows retrieved.
- Ensure table statistics are accurate, since missing or out of data statistics can result in poor query plan selection.
- Increase the size of the data page cache and prime all the caches.
- Tune the size of database pages. Using large database pages has provided a performance improvement of up to 50%. There are also other storage parameters worth tweaking. If you use large database pages, increase the amount of memory available to Derby.
- Avoid expensive queries.
- Use the appropriate getXXX and setXXX methods for the type.
- Tune database booting/class loading. System startup time can be improved by reducing the number of databases in the system directory.
- Avoid inserts in autocommit mode if possible. Speed up insert performance.
- Improve the performance of table functions. Force more efficient join orders for queries which use table functions.
- Configure Derby to use an in-memory database. Tune the Java heap and Derby page cache size when using an in-memory database.

These tips might solve your particular performance problem. Be sure to visit the Support section of Derby's Web site for up-to-date performance tips and tricks.

- Use prepared statements with substitution parameters
- Create indexes, and make sure they are being used
- Ensure table statistics are accurate
- Increase the size of the data page cache
- Tune the size of database pages
- Avoid expensive queries
- Use the appropriate getXXX and setXXX methods for the type
  For performance reasons, use the recommended getXXX method when retrieving values, and use the recommended setXXX method when setting values for parameters.
- Tune database booting/class loading
- Avoid inserts in autocommit mode if possible
- Improve the performance of table functions
- Configure Derby to use an in-memory database

Parent topic: Performance tips and tricks
Related concepts
More tips