delete index parameter

The delete index parameter controls the optimizing, or compacting, of the index. Optimizing the index removes index information for deleted documents and releases disk space. You can optimize the bts index manually, which is the default mode, or automatically.

Optimize the index manually

When you create a bts index, the default mode for deleting rows is deferred (delete="deferred"). A delete operation on a row in a table marks the row as deleted in the bts index. The disk space can be reclaimed as more documents are added to the index. Queries that are run against bts columns do not return the deleted documents.

To release disk space that is occupied by the deleted documents in the index, use the oncheck utility in the format:
oncheck -ci -y db_name:table_name#index_name

Alternatively, you can use the bts_index_compact() function to release disk space for the rows marked for deletion. The difference between the two methods is that the bts_index_compact() function requires that you know the directory path to the bts index, whereas the oncheck utility requires that you know the database name, table name, and the index name. Both methods have the same result.

Delete operations are faster in the deferred mode. The deferred deletion mode is best for large indexes that are updated frequently.

Optimize the index automatically

You can override the deferred deletion mode by creating the bts index with the delete="immediate" parameter. In the immediate deletion mode, index information for deleted documents is physically removed from the index after every delete operation. This mode frees up space in the index immediately. However, the immediate deletion mode rewrites the index each time an index entry is deleted, which slows down delete operations and makes the index unusable during the delete operation.