You are here: Troubleshooting > Speed and Scalability Issues > Increasing the Maximum Database File Size

Increasing the Maximum Database File Size

To increase the database size you need to increase the block size. This configuration setting has only an effect when you create a new database or when you defragment an existing database. See "Block Size"

When you want to know what contributes to the database file size see here.

EmbeddedConfiguration configuration = Db4oEmbedded.newConfiguration();
configuration.file().blockSize(8);
FileConfiguration.java: Increase block size for larger databases

Advantage

Increasing the block size from the default of one to a higher value permits you to store more data in a db4o database.

Effect

By default db4o databases can have a maximum size of 2GB. By increasing the block size, the upper limit for database files sizes can be raised to multiples of 2GB. Any value between 1 byte (2GB) to 127 bytes (254GB) can be chosen as the block size.

Because of possible padding for objects that are not exact multiples in length of the block size, database files will naturally tend to be bigger when a higher value is chosen. It may also leads to more file cache misses and therefore can decrease performance.

A very good choice for this value is 8, because that corresponds to the slot length of the pointers (address + length) that db4o internally uses.