You are here: Advanced Features > Defragment > Defragmentation Configuration > Commit Frequency

Commit Frequency

The defragmentation system uses db4o's transactional core to write the data to the new defragmented file. For large databases managing a long transaction can become an issue and can slow down the defragmentation. Therefore you can set a commit frequency. This means after the set number of processed objects the transaction is committed on the new file.

DefragmentConfig config = new DefragmentConfig("database.db4o");
config.ObjectCommitFrequency(10000);

Defragment.Defrag(config);
DefragmentationConfigurationExamples.cs: Set the commit frequency
Dim config As New DefragmentConfig("database.db4o")
config.ObjectCommitFrequency(10000)

Defragment.Defrag(config)
DefragmentationConfigurationExamples.vb: Set the commit frequency