I'm trying to understand why a database might need several indices.
Given this code:
DatabaseManager dbm = databaseSystem.getDatabaseManager();
Database db = dbman.createDatabase("myDB",5);
and this code
BabuDBRequestResult<Object> result = db.singleInsert(2, "key".getBytes(), "value".getBytes(), context);
result.get();
Why did I createDatabase with 5 indices? When an item is being inserted, index 2 is being specified, what does that really mean?
I am assuming BabuDB is basically a disk persistent hash map, or something like a B-tree library. How do indices come into play here?
I understand that the internal implementation uses several in-memory trees. As each tree fills up, it is 'sealed' and a new tree is started. While the new tree is being used, old trees, which are no longer being modified, are merged, sorted and written to disk. Does BabuDB 'index' refer to these in-memory trees? If so, why would I specify the index I want to use to insert data?
Are these indieces just worker threads? Do I specify the index to be used for singleInsert to make sure the order of inserts is correct? In other words, does having 5 indices mean five mailboxes in the actor model, where each mailbox retains the order of events, but the order is not guaranteed across mailboxes?