What is the best way to add indexes?
In Berkeley DB XML it is best to specify indexes on a container before documents are inserted. When indexes in a populated container are changed, all documents in that container must be reindexed, and this can take a long time. If indexes must be changed after the fact, it is best to add/remove several at once, to amortize the cost of the reindex. This means using code that looks like this: // get the index specification XmlIndexSpecification ispec = container.getIndexSpecification(); // modify the index specification, as desired … // reset the index specification container.setIndexSpecification(ispec, …); It is very simple to use the dbxml shell program to add or remove a single index, but because the shell can only manipulate one index at a time, using the shell to manage indexes on a populated container may be less efficient than using code.