Working With Large Amounts Of Data

db4o is designed to manage large amounts of data. The following paragraphs highlight some information important for using db4o with large data.

Size of Database Files

In the default setting, the maximum database file size is 2GB.

You can increase this value by configuring the internal db4o block size:

.NET:

configuration.BlockSize(blockSize)

As a parameter you can specify any value between 1 and 127. The resulting maximum database file size will be a multiple of 2GB. A recommended setting for large database files is 8, since internal pointers have this length.

Using blockSize the maximum database file size will be 16GB.

The above method has to be called before an ObjectContainer is opened the first time. During the lifetime of an ObjectContainer the setting will have to stay the same. Since Defragment copies all objects to a new ObjectContainer, it can be used to change the blockSize of an existing database:

.NET:

Defragment.Defrag("filename.db4o")

Performance

Navigation access times to objects and the performance of access by internal IDs remains constant, no matter how large database files are.

Query performance on unindexed objects drops linearly with an increasing number of objects per class.

Query performance on a large number of objects can be dramatically improved by using indexes:

.NET:

configuration.ObjectClass(typeof(Foo)).ObjectField("bar").Indexed(true);

db4o storage performance is very good. It is recommended to run your own benchmarks with large amounts of data to check the overall performance on your particular class hierarchy.