Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Rebuild and Compact Optimization

In addition to the other options given, the following adjustments will optimize rebuild and compact speeds.

Single-user Standalone Index Cache

Utilities built around the RebuildIFile() function should use Single-user Standalone libraries to take advantage of index caching. To increase the size of the index cache, increase the number of index buffers, i.e., bufs parameter to InitISAM(). The index cache uses a hashing algorithm, therefore the larger the index cache the faster the rebuild will be. The size of the index cache can be calculated as follows:

memory(in bytes) = bufs *(sect * 128 + MAXLEN + 128)

MAXLEN, the maximum key length defined in ctopt2.h, defaults to 1024 bytes.

The buffer size has a default maximum of 16000 bytes. Use #define ctMAXSORTBUF in ctoptn.h/ctree.mak when building your library to specify a larger maximum for an additional speed boost.

Sort Files

Rebuild times can also be optimized by increasing the number of temporary sort files used. Increase the #define MAX_HANDLES found in ctsort.h from its default of 50 to a larger number up to the maximum of 255. The value to use is a function of the size of the index to be rebuilt and the number of available file handles and is best determined by performing timing tests on the target system. The temporary files created during rebuild are FairCom DB files. After changing ctsort.h, recompile the entire FairCom DB library, including removing the object files and library, and the rebuild application.