Product Documentation

FairCom RTG BTRV User Guide

Previous Topic

Next Topic

<optimisticadd>

The <optimisticadd> option enables adding keys before the data during WRITE operations.

The strategy that c-tree uses to add new records consists of adding the data record first and subsequently adding the keys in the indexes. In case of duplicate keys errors, the record just added is deleted. This approach is optimistic as it assumes that the user is attempting to add new records with unique keys and only occasionally the operation fails with duplicate errors.

A common practice is to use a pessimistic approach where the WRITE is performed mostly on already existing keys and the Btrieve programmer relies on the WRITE return code to know if a key already exists. In such cases, the default optimistic approach used by c-tree does not provide optimal performance.

When <optimisticadd> is enabled (default), c-tree uses an optimistic strategy which provides optimal performance when adding non-existing records.

When <optimisticadd> is disabled, c-tree uses a pessimistic strategy that attempts to add unique keys before adding the data record.

Examples

To disable <optimisticadd>:

<optimisticadd>no<optimisticadd>

To enable <optimisticadd> (default):

<optimisticadd>yes<optimisticadd>

TOCIndex