# Configure Derby to use an in-memory database

Tune the Java heap and Derby page cache size when using an in-memory database.

If you use Derby's in-memory database facility, it is important to configure the following:

- The size of the Java heap. The memory requirements for an in-memory database should be similar to the memory requirements for using the file system, plus the size of the user data.
- The Derby page cache size. For good performance, use no less than the default size of 1000 pages. The data must pass through the page cache, even though the user data is already stored in main memory. A larger page cache may improve performance at the expense of increased memory usage. See Increase the size of the data page cache for more information.

If you want to prevent Derby from writing anything to the `derby.log` file, use one of the derby.stream.error properties (for instance, derby.stream.error.field).

For more information, see "Using in-memory databases" in the Derby Developer's Guide.

Parent topic: Performance tips and tricks
Related concepts
Use prepared statements with substitution parameters
Create indexes, and make sure they are being used
Ensure that 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
Tune database booting/class loading
Avoid inserts in autocommit mode if possible
Improve the performance of table functions
Increase the concurrency of sequences
Shut down the system properly
Put Derby first in your classpath