# Voluntary Indexes

> With eXtremeDB, the only way to access database objects is via an index or indexes. Normally the indexes are populated and updated in the course of normal database put operations. However, the `voluntary` qualifier for an index is provided to indicate that the index can be initiated or dropped at runtime. Voluntary indexes are populated and updated only when the application explicitly requires it. This feature allows the application to:

> > 1. Save database memory for indexes that are not required at a given time.

> > 2. Save the time required to update the index during database put operations.

> In another hand, if the application does not update the index on every operation then it will take time to build the index when the application decides to do so by calling the index create API.

> As a consequence, eXtremeDB requires having at least one non-voluntary index in a class (or a `list` index) to be able to scan the entire class data in order to build the `voluntary` index. Another possible side effect is the possibility of running out of database memory during the index re-creation. Also, the re-creation of a `voluntary` index for a `persistent` class may take a significant amount of time because of the possibly large amount of objects to scan.

> All other operations on the `voluntary` indexes are the same as on all other regular indexes.

> In the C API, voluntary indexes are not built until an explicit call to the generated function `classname_indexname_create()` is made by the application. In the same fashion, the application can remove a voluntary index by calling the generated function `classname_indexname_drop()`.