db4o allows to index fields to provide maximum querying performance. To request an index to be created, you would issue the following API method call in your global db4o configuration method before you open an ObjectContainer/ObjectServer:
EmbeddedConfiguration configuration = Db4oEmbedded.newConfiguration();
configuration.common().objectClass(Person.class).objectField("name").indexed(true);
If the configuration is set in this way, an index on the Foo#bar field will be created (if not present already) the next time you open an ObjectContainer/ObjectServer and you use the Foo class the first time in your applcation.
Contrary to all other configuration calls indexes - once created - will remain in a database even if the index configuration call is not issued before opening an ObjectContainer/ObjectServer.
You can drop an index by explicitly calling index(false).Dropping the index will take place the next time the respective class is used.
You can see db4o dropping and crating indexes, when you increate the message-level.
For creating and dropping indexes on large amounts of objects there are two possible strategies:
For more information see Enable Field Indexes chapter.